We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Due to: https://github.com/dtolnay/trybuild/pull/278/files#diff-36dcce9bb960d87a9efde38a0309b8e3e552a4193594bb2065ced1e749c9b743R41 the latests version doesn't propagate the RUSTFLAGS anymore.
In our usecase we pass deny warnings using the RUSTFLAGS environment variable.
deny warnings
This is very handy to ensure no warnings ever gets emitted from our macros.
#[test] fn tests() { std::env::set_var("RUSTFLAGS", "--deny warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/*rs"); }
Is there a way to allow giving rustflags maybe with a new TRYBUILD_RUSTFLAGS or something?
If you approve the direction I can make a PR
The text was updated successfully, but these errors were encountered:
I was thinking something like this maybe:
pub(crate) fn toml() -> toml::Value { - let mut rustflags = vec!["--cfg", "trybuild", "--verbose"]; + let mut rustflags = Vec::<String>::new(); + // Propagate some rustflags from env: + for flag in rustflags::from_encoded(&std::env::var_os("TRYBUILD_RUSTFLAGS").unwrap_or_default() + + ) { + match flag { + rustflags::Flag::Deny(s) => { + rustflags.push("-D".into()); + rustflags.push(s); + }, + rustflags::Flag::Forbid(s) => { + rustflags.push("-D".into()); + rustflags.push(s); + }, + rustflags::Flag::Allow(s) => { + rustflags.push("-A".into()); + rustflags.push(s); + }, + rustflags::Flag::Warn(s) => { + rustflags.push("-W".into()); + rustflags.push(s); + }, + rustflags::Flag::Cfg { name, value: Some(value) } => { + rustflags.push("--cfg".into()); + rustflags.push(format!("{}=\"{}\"", name, value)); + }, + rustflags::Flag::Cfg { name, value: None } => { + rustflags.push("--cfg".into()); + rustflags.push(name.into()); + }, + _ => (), + } + } + + rustflags.extend_from_slice(&["--cfg".into(), "trybuild".into(), "--verbose".into()]); for &lint in IGNORED_LINTS { - rustflags.push("-A"); - rustflags.push(lint); + rustflags.push("-A".into()); + rustflags.push(lint.into()); } toml::Value::try_from(rustflags).unwrap() }
Sorry, something went wrong.
No branches or pull requests
Due to:
https://github.com/dtolnay/trybuild/pull/278/files#diff-36dcce9bb960d87a9efde38a0309b8e3e552a4193594bb2065ced1e749c9b743R41
the latests version doesn't propagate the RUSTFLAGS anymore.
In our usecase we pass
deny warnings
using the RUSTFLAGS environment variable.This is very handy to ensure no warnings ever gets emitted from our macros.
Is there a way to allow giving rustflags maybe with a new TRYBUILD_RUSTFLAGS or something?
If you approve the direction I can make a PR
The text was updated successfully, but these errors were encountered: