Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cfg-gated unsafe. #13

Closed
vi opened this issue Jun 26, 2018 · 4 comments
Closed

cfg-gated unsafe. #13

vi opened this issue Jun 26, 2018 · 4 comments
Labels
question Further information is requested

Comments

@vi
Copy link

vi commented Jun 26, 2018

Shall it handle #[cfg(feature=...)] and other optional unsafe code?

@anderejd
Copy link
Contributor

Good question. I think there’s value in gathering unsafe stats without splitting the results per feature, but it could also be interesting to tag each unsafe usage with related cfg attributes. The scanning could always look for cfg attributes and allow optional presentation based on extra command line flags.

@anderejd anderejd added the question Further information is requested label Jun 26, 2018
@vi
Copy link
Author

vi commented Jun 26, 2018

I mean primarily making cargo geiger --all-features, cargo geiger --no-default-features work.

Currently it shows the same number regardless of --target or --features, at least for the root crate.

@anderejd
Copy link
Contributor

I mean primarily making cargo geiger --all-features, cargo geiger --no-default-features work.

Ah, yes. That makes sense.

@pinkforest
Copy link
Collaborator

pinkforest commented Jan 6, 2022

Repro

Using tokio/tokio as featuregate example

Using 0.11.2 straight from git

docker run -ti --rm rust /bin/bash

    cargo install cargo-geiger --git https://github.com/rust-secure-code/cargo-geiger --force
    mkdir app ; cd app
    git clone https://github.com/tokio-rs/tokio.git .
    cd tokio
    cargo geiger

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.59.0-nightly (c5ecc1570 2021-12-15)

tokio/tokio
cargo geiger --no-default-features
23/136 1245/9291 73/189 1/17 61/286

cargo geiger --all-features
108/136 7453/9291 172/189 17/17 192/286

cargo geiger (it's nothing included by default)
23/136 1245/9291 73/189 1/17 61/286

cargo geiger --features fs
23/136 1251/9291 73/189 1/17 63/286

implementation wise It goes to cargo CompileOptions from_cli currently #226 but we are aiming to decouple

Closing as it's been resolved - re-opening if any issues that we can reproduce re: feature gate.

There were some other errors from tokio/tokio related to another issue I've linked that will track there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants