@@ -369,6 +369,8 @@ mod desc {
369369 pub const parse_opt_langid: & str = "a language identifier" ;
370370 pub const parse_opt_pathbuf: & str = "a path" ;
371371 pub const parse_list: & str = "a space-separated list of strings" ;
372+ pub const parse_list_with_polarity: & str =
373+ "a comma-separated list of strings, with elements beginning with + or -" ;
372374 pub const parse_opt_comma_list: & str = "a comma-separated list of strings" ;
373375 pub const parse_number: & str = "a number" ;
374376 pub const parse_opt_number: & str = parse_number;
@@ -530,6 +532,22 @@ mod parse {
530532 }
531533 }
532534
535+ crate fn parse_list_with_polarity ( slot : & mut Vec < ( String , bool ) > , v : Option < & str > ) -> bool {
536+ match v {
537+ Some ( s) => {
538+ for s in s. split ( "," ) {
539+ match s. chars ( ) . next ( ) {
540+ Some ( '+' ) => slot. push ( ( s[ 1 ..] . to_string ( ) , true ) ) ,
541+ Some ( '-' ) => slot. push ( ( s[ 1 ..] . to_string ( ) , false ) ) ,
542+ _ => return false ,
543+ }
544+ }
545+ true
546+ }
547+ None => false ,
548+ }
549+ }
550+
533551 crate fn parse_location_detail ( ld : & mut LocationDetail , v : Option < & str > ) -> bool {
534552 if let Some ( v) = v {
535553 ld. line = false ;
@@ -1319,6 +1337,10 @@ options! {
13191337 mir_emit_retag: bool = ( false , parse_bool, [ TRACKED ] ,
13201338 "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
13211339 (default: no)") ,
1340+ mir_enable_passes: Vec <( String , bool ) > = ( Vec :: new( ) , parse_list_with_polarity, [ TRACKED ] ,
1341+ "use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be \
1342+ enabled, overriding all other checks. Passes that are not specified are enabled or \
1343+ disabled by other flags as usual.") ,
13221344 mir_opt_level: Option <usize > = ( None , parse_opt_number, [ TRACKED ] ,
13231345 "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)" ) ,
13241346 move_size_limit: Option <usize > = ( None , parse_opt_number, [ TRACKED ] ,
0 commit comments