-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 (special marked options) are recorded in metainfo #133138
base: master
Are you sure you want to change the base?
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
This comment has been minimized.
This comment has been minimized.
d99ff62
to
bd52a23
Compare
This comment has been minimized.
This comment has been minimized.
bd52a23
to
500600b
Compare
This comment has been minimized.
This comment has been minimized.
db91299
to
43e5956
Compare
This comment has been minimized.
This comment has been minimized.
43e5956
to
6793451
Compare
95f9595
to
9cd86c3
Compare
@rustbot ready |
9cd86c3
to
97a8240
Compare
This comment has been minimized.
This comment has been minimized.
97a8240
to
8603b2b
Compare
8603b2b
to
95ffdf8
Compare
This comment was marked as resolved.
This comment was marked as resolved.
95ffdf8
to
c59d611
Compare
Re-worked as a hard error. |
@rustbot ready |
c59d611
to
7dfbf13
Compare
This comment has been minimized.
This comment has been minimized.
…d compared to be equal in different crates
7dfbf13
to
6741a49
Compare
//@ needs-llvm-components: x86 | ||
//@ revisions:error_generated allow_regparm_mismatch | ||
|
||
//@[allow_regparm_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=regparm |
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.
Can you add another test showing that -Cunsafe-allow-abi-mismatch
must be provided a value?
compiler/rustc_metadata/messages.ftl
Outdated
metadata_incompatible_target_modifiers = | ||
mixing `{$flag_name_prefixed}` will cause an ABI mismatch | ||
.note = `{$flag_name_prefixed}={$flag_local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$flag_extern_value}` in dependency `{$extern_crate}` | ||
.help = `{$flag_name_prefixed}` modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely |
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.
.help = `{$flag_name_prefixed}` modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely | |
.help = this error occurs because the `{$flag_name_prefixed}` flag modifies the ABI, | |
and different crates in your project were compiled with inconsistent | |
values | |
.help = to resolve this, ensure that `{$flag_name_prefixed}` is set to the same value | |
for all crates during compilation |
Implemented CodegenOptionsTargetModifiers and UnstableOptionsTargetModifiers enums generation. To generate enums with |
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.
I think the enum key is a lot better, I'll pass this on to someone else just to get another opinion on it.
pub enum OptionsTargetModifiers { | ||
CodegenOptions(CodegenOptionsTargetModifiers), | ||
UnstableOptions(UnstableOptionsTargetModifiers), | ||
} |
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 should probably be generated like the Options
struct, just in case any top-level arguments are target modifiers.
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.
OptionsTargetModifiers enum is now generated by macro to support substruct option groups. But top-level arguments can't now be target modifiers, because they are processed in a different way, they are not parsed by the same "parse_*" functions system. They are set manually in different places.
Target modifiers are now supported only for codegen/unstable option groups.
@@ -1986,10 +2221,10 @@ options! { | |||
"enable queries of the dependency graph for regression testing (default: no)"), | |||
randomize_layout: bool = (false, parse_bool, [TRACKED], | |||
"randomize the layout of types (default: no)"), | |||
reg_struct_return: bool = (false, parse_bool, [TRACKED], | |||
reg_struct_return: bool = (false, parse_bool, [TRACKED TMOD], |
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.
I think it would better if TMOD
was TARGET_MODIFIER
in these macros.
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.
r? compiler |
Target modifiers (special marked options) are recorded in metainfo and compared to be equal in different linked crates.
Draft PR for this RFC: rust-lang/rfcs#3716
Option may be marked as
TMOD
, example:regparm: Option<u32> = (None, parse_opt_number, [TRACKED TMOD]
.If an TMOD-marked option has non-default value, it will be recorded in crate metainfo as a
Vec<TargetModifier>
:Option value code is generated using
Debug
trait.Error example:
-Cunsafe-allow-abi-mismatch=regparm,reg-struct-return
to disable list of flags.