@@ -136,18 +136,19 @@ impl TargetModifier {
136136 pub fn consistent ( & self , sess : & Session , other : Option < & TargetModifier > ) -> bool {
137137 assert ! ( other. is_none( ) || self . opt == other. unwrap( ) . opt) ;
138138 match self . opt {
139- OptionsTargetModifiers :: UnstableOptions ( unstable ) => match unstable {
140- UnstableOptionsTargetModifiers :: sanitizer => {
139+ OptionsTargetModifiers :: CodegenOptions ( stable ) => match stable {
140+ CodegenOptionsTargetModifiers :: sanitize => {
141141 return target_modifier_consistency_check:: sanitizer ( self , other) ;
142142 }
143+ } ,
144+ OptionsTargetModifiers :: UnstableOptions ( unstable) => match unstable {
143145 UnstableOptionsTargetModifiers :: sanitizer_cfi_normalize_integers => {
144146 return target_modifier_consistency_check:: sanitizer_cfi_normalize_integers (
145147 sess, self , other,
146148 ) ;
147149 }
148150 _ => { }
149151 } ,
150- _ => { }
151152 } ;
152153 match other {
153154 Some ( other) => self . extend ( ) . tech_value == other. extend ( ) . tech_value ,
@@ -1263,26 +1264,14 @@ pub mod parse {
12631264 }
12641265
12651266 pub ( crate ) fn parse_sanitizers ( slot : & mut SanitizerSet , v : Option < & str > ) -> bool {
1266- if let Some ( v) = v {
1267- for s in v. split ( ',' ) {
1268- * slot |= match s {
1269- "address" => SanitizerSet :: ADDRESS ,
1270- "cfi" => SanitizerSet :: CFI ,
1271- "dataflow" => SanitizerSet :: DATAFLOW ,
1272- "kcfi" => SanitizerSet :: KCFI ,
1273- "kernel-address" => SanitizerSet :: KERNELADDRESS ,
1274- "leak" => SanitizerSet :: LEAK ,
1275- "memory" => SanitizerSet :: MEMORY ,
1276- "memtag" => SanitizerSet :: MEMTAG ,
1277- "shadow-call-stack" => SanitizerSet :: SHADOWCALLSTACK ,
1278- "thread" => SanitizerSet :: THREAD ,
1279- "hwaddress" => SanitizerSet :: HWADDRESS ,
1280- "safestack" => SanitizerSet :: SAFESTACK ,
1281- "realtime" => SanitizerSet :: REALTIME ,
1282- _ => return false ,
1283- }
1267+ if let Some ( s) = v {
1268+ let sanitizer_set = SanitizerSet :: from_comma_list ( s) ;
1269+ if sanitizer_set. is_ok ( ) {
1270+ * slot |= sanitizer_set. unwrap ( ) ;
1271+ true
1272+ } else {
1273+ false
12841274 }
1285- true
12861275 } else {
12871276 false
12881277 }
@@ -2186,8 +2175,8 @@ options! {
21862175 "output remarks for these optimization passes (space separated, or \" all\" )" ) ,
21872176 rpath: bool = ( false , parse_bool, [ UNTRACKED ] ,
21882177 "set rpath values in libs/exes (default: no)" ) ,
2189- save_temps : bool = ( false , parse_bool , [ UNTRACKED ] ,
2190- "save all temporary output files during compilation (default: no) " ) ,
2178+ sanitize : SanitizerSet = ( SanitizerSet :: empty ( ) , parse_sanitizers , [ TRACKED TARGET_MODIFIER ] ,
2179+ "use one or multiple sanitizers " ) ,
21912180 soft_float: bool = ( false , parse_bool, [ TRACKED ] ,
21922181 "deprecated option: use soft float ABI (*eabihf targets only) (default: no)" ) ,
21932182 #[ rustc_lint_opt_deny_field_access( "use `Session::split_debuginfo` instead of this field" ) ]
@@ -2205,6 +2194,8 @@ options! {
22052194 This feature is unsafe.") ,
22062195 unsafe_allow_abi_mismatch: Vec <String > = ( Vec :: new( ) , parse_comma_list, [ UNTRACKED ] ,
22072196 "Allow incompatible target modifiers in dependency crates (comma separated list)" ) ,
2197+ save_temps: bool = ( false , parse_bool, [ UNTRACKED ] ,
2198+ "Allow incompatible target modifiers in dependency crates (comma separated list)" ) ,
22082199 // tidy-alphabetical-end
22092200
22102201 // If you add a new option, please update:
@@ -2604,9 +2595,6 @@ written to standard error output)"),
26042595 retpoline_external_thunk: bool = ( false , parse_bool, [ TRACKED TARGET_MODIFIER ] ,
26052596 "enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \
26062597 target features (default: no)") ,
2607- #[ rustc_lint_opt_deny_field_access( "use `Session::sanitizers()` instead of this field" ) ]
2608- sanitizer: SanitizerSet = ( SanitizerSet :: empty( ) , parse_sanitizers, [ TRACKED TARGET_MODIFIER ] ,
2609- "use a sanitizer" ) ,
26102598 sanitizer_cfi_canonical_jump_tables: Option <bool > = ( Some ( true ) , parse_opt_bool, [ TRACKED ] ,
26112599 "enable canonical jump tables (default: yes)" ) ,
26122600 sanitizer_cfi_generalize_pointers: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
@@ -2624,6 +2612,9 @@ written to standard error output)"),
26242612 saturating_float_casts: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
26252613 "make float->int casts UB-free: numbers outside the integer type's range are clipped to \
26262614 the max/min integer respectively, and NaN is mapped to 0 (default: yes)") ,
2615+ #[ rustc_lint_opt_deny_field_access( "use `Session::sanitizers()` instead of this field" ) ]
2616+ sanitizer: SanitizerSet = ( SanitizerSet :: empty( ) , parse_sanitizers, [ TRACKED TARGET_MODIFIER ] ,
2617+ "use one or multiple sanitizers" ) ,
26272618 self_profile: SwitchWithOptPath = ( SwitchWithOptPath :: Disabled ,
26282619 parse_switch_with_opt_path, [ UNTRACKED ] ,
26292620 "run the self profiler and output the raw event data" ) ,
0 commit comments