Skip to content

Commit 074ed7b

Browse files
Rollup merge of rust-lang#155389 - Zalathar:flag-macros, r=mati865
Simplify macros for target-modifier and mitigation flags - Rebased and revised version of rust-lang#154501. --- The macros used for handling command-line flags that are “target modifiers” or “mitigations” are quite complicated, and can be significantly simplified by tweaking their syntax and by making use of `${ignore(..)}` metavars. It's possible that more code could be moved out of macros (e.g. declaring some of the enums by hand), but that can be investigated in a potential follow-up. There should be no change to compiler behaviour.
2 parents 515c670 + fb27b3b commit 074ed7b

4 files changed

Lines changed: 121 additions & 298 deletions

File tree

compiler/rustc_session/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2641,7 +2641,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
26412641
if unstable_opts.retpoline_external_thunk {
26422642
unstable_opts.retpoline = true;
26432643
collected_options.target_modifiers.insert(
2644-
OptionsTargetModifiers::UnstableOptions(UnstableOptionsTargetModifiers::retpoline),
2644+
OptionsTargetModifiers::UnstableOptions(UnstableOptionsTargetModifiers::Retpoline),
26452645
"true".to_string(),
26462646
);
26472647
}

compiler/rustc_session/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![feature(default_field_values)]
66
#![feature(iter_intersperse)]
77
#![feature(macro_derive)]
8+
#![feature(macro_metavar_expr)]
89
#![feature(rustc_attrs)]
910
// To generate CodegenOptionsTargetModifiers and UnstableOptionsTargetModifiers enums
1011
// with macro_rules, it is necessary to use recursive mechanic ("Incremental TT Munchers").

0 commit comments

Comments
 (0)