-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Allow to pass or propagate some RUSTFLAGS #283
Comments
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()
} |
Seems you may be able to use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: