-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Target modifiers fix for bool flags without value #138483
base: master
Are you sure you want to change the base?
Target modifiers fix for bool flags without value #138483
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
This comment has been minimized.
This comment has been minimized.
908d92f
to
080cbc2
Compare
| ^ | ||
| | ||
= help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely | ||
= note: `-Zreg-struct-return unset` in this crate is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem correct (unset in the backticks?), plus the string is untranslatable. I'd suggest adding a variant to the strings that explicitly says "unset" and use that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added messages for cases when current crate has unset flag and when external crate has unset flag.
{ | ||
target_modifiers.insert(tmod, value.to_string()); | ||
if let Some(tmod) = *tmod { | ||
let v = if let Some(v) = value { v.to_string() } else { String::new() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would value.map_or_default(ToOwned::to_owned)
work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to map_or(...)
, looks like map_or_default
is not yet merged for Option.
= note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return=` in dependency `default_reg_struct_return` | ||
= help: set `-Zreg-struct-return=` in this crate or `-Zreg-struct-return=true` in `default_reg_struct_return` | ||
= note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return unset` in dependency `default_reg_struct_return` | ||
= help: set `-Zreg-struct-return unset` in this crate or `-Zreg-struct-return=true` in `default_reg_struct_return` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this diagnostic is poor. it should be something like
= help: set `-Zreg-struct-return unset` in this crate or `-Zreg-struct-return=true` in `default_reg_struct_return` | |
= help: unset `-Zreg-struct-return` in this crate or set `-Zreg-struct-return=true` in `default_reg_struct_return` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
080cbc2
to
6ccaea1
Compare
@rustbot review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@bors r+ |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
Fixed support of boolean flags without values:
-Zbool-flag
is now consistent with-Zbool-flag=true
in another crate.When flag is explicitly set to default value, target modifier will not be set in crate metainfo (
-Zflag=false
whenfalse
is a default value for the flag).Improved error notification when target modifier flag is absent in a crate ("-Zflag unset").
Example: