Skip to content

Commit 73feaa4

Browse files
authored
Unrolled build for #140898
Rollup merge of #140898 - onur-ozkan:miri-run, r=Kobzol minor improvements on running miri It should be clear from the commit messages when reviewing them one by one.
2 parents 40d2563 + 17d27c9 commit 73feaa4

File tree

1 file changed

+13
-3
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+13
-3
lines changed

src/bootstrap/src/core/build_steps/run.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)