File tree 4 files changed +14
-0
lines changed
4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -649,6 +649,9 @@ changelog-seen = 2
649
649
# "thin" or "fat" to apply Thin/Fat LTO to the `rustc_driver` dylib.
650
650
#lto = "thin-local"
651
651
652
+ # Build compiler with the optimization enabled and -Zvalidate-mir, currently only for `std`
653
+ #validate-mir-opts = 3
654
+
652
655
# =============================================================================
653
656
# Options for specific targets
654
657
#
Original file line number Diff line number Diff line change @@ -1871,6 +1871,13 @@ impl<'a> Builder<'a> {
1871
1871
}
1872
1872
}
1873
1873
1874
+ if matches ! ( mode, Mode :: Std ) {
1875
+ if let Some ( mir_opt_level) = self . config . rust_validate_mir_opts {
1876
+ rustflags. arg ( "-Zvalidate-mir" ) ;
1877
+ rustflags. arg ( & format ! ( "-Zmir-opt-level={}" , mir_opt_level) ) ;
1878
+ }
1879
+ }
1880
+
1874
1881
Cargo { command : cargo, rustflags, rustdocflags }
1875
1882
}
1876
1883
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ pub struct Config {
168
168
pub rust_profile_use : Option < String > ,
169
169
pub rust_profile_generate : Option < String > ,
170
170
pub rust_lto : RustcLto ,
171
+ pub rust_validate_mir_opts : Option < u32 > ,
171
172
pub llvm_profile_use : Option < String > ,
172
173
pub llvm_profile_generate : bool ,
173
174
pub llvm_libunwind_default : Option < LlvmLibunwind > ,
@@ -762,6 +763,7 @@ define_config! {
762
763
// ignored; this is set from an env var set by bootstrap.py
763
764
download_rustc: Option <StringOrBool > = "download-rustc" ,
764
765
lto: Option <String > = "lto" ,
766
+ validate_mir_opts: Option <u32 > = "validate-mir-opts" ,
765
767
}
766
768
}
767
769
@@ -1136,6 +1138,7 @@ impl Config {
1136
1138
. as_deref ( )
1137
1139
. map ( |value| RustcLto :: from_str ( value) . unwrap ( ) )
1138
1140
. unwrap_or_default ( ) ;
1141
+ config. rust_validate_mir_opts = rust. validate_mir_opts ;
1139
1142
} else {
1140
1143
config. rust_profile_use = flags. rust_profile_use ;
1141
1144
config. rust_profile_generate = flags. rust_profile_generate ;
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-manage-submodules"
64
64
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-locked-deps"
65
65
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-cargo-native-static"
66
66
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --set rust.codegen-units-std=1"
67
+ RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --set rust.validate-mir-opts=3"
67
68
68
69
# Only produce xz tarballs on CI. gz tarballs will be generated by the release
69
70
# process by recompressing the existing xz ones. This decreases the storage
You can’t perform that action at this time.
0 commit comments