File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/bootstrap/src/core/build_steps Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -118,15 +118,25 @@ impl Step for Miri {
118118 fn run ( self , builder : & Builder < ' _ > ) {
119119 let host = builder. build . build ;
120120 let target = self . target ;
121- let stage = builder. top_stage ;
121+
122+ // `x run` uses stage 0 by default but miri does not work well with stage 0.
123+ // Change the stage to 1 if it's not set explicitly.
124+ let stage = if builder. config . is_explicit_stage ( ) || builder. top_stage >= 1 {
125+ builder. top_stage
126+ } else {
127+ 1
128+ } ;
129+
122130 if stage == 0 {
123131 eprintln ! ( "miri cannot be run at stage 0" ) ;
124132 std:: process:: exit ( 1 ) ;
125133 }
126134
127135 // This compiler runs on the host, we'll just use it for the target.
128- let target_compiler = builder. compiler ( stage, host) ;
129- let host_compiler = tool:: get_tool_rustc_compiler ( builder, target_compiler) ;
136+ let target_compiler = builder. compiler ( stage, target) ;
137+ let miri_build = builder. ensure ( tool:: Miri { compiler : target_compiler, target } ) ;
138+ // Rustc tools are off by one stage, so use the build compiler to run miri.
139+ let host_compiler = miri_build. build_compiler ;
130140
131141 // Get a target sysroot for Miri.
132142 let miri_sysroot = test:: Miri :: build_miri_sysroot ( builder, target_compiler, target) ;
You can’t perform that action at this time.
0 commit comments