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

Dead code warnings if the environment contains RUSTFLAGS #12

Closed
dtolnay opened this issue Jun 2, 2019 · 1 comment
Closed

Dead code warnings if the environment contains RUSTFLAGS #12

dtolnay opened this issue Jun 2, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@dtolnay
Copy link
Owner

dtolnay commented Jun 2, 2019

We currently write out a .cargo/config containing [build] rustflags = ["-A", "dead_code"]:

trybuild/src/run.rs

Lines 178 to 187 in 32f36c4

let mut rustflags = Vec::new();
for &lint in IGNORED_LINTS {
rustflags.push("-A".to_owned());
rustflags.push(lint.to_owned());
}
Config {
build: Build { rustflags },
}

This fails to take effect if the shell has RUSTFLAGS defined, as that overrides whatever is in .cargo/config.

Maybe instead of using .cargo/config we need to pass Cargo a RUSTFLAGS consisting of $RUSTFLAGS -A dead_code in the case that a RUSTFLAGS exists already.

FYI @jonhoo

@dtolnay dtolnay added the bug Something isn't working label Jun 2, 2019
@dtolnay
Copy link
Owner Author

dtolnay commented Jun 7, 2019

Fixed in trybuild 1.0.5. Tested by running RUSTFLAGS="-C target-cpu=native" cargo test against jonhoo/proc-macro-workshop@382f32a and observing that the dead code warnings no longer appear.

@dtolnay dtolnay closed this as completed Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant