|
1 | 1 | //! Implementation of compiling the compiler and standard library, in "check"-based modes. |
2 | 2 |
|
3 | | -use build_helper::exit; |
4 | | - |
5 | 3 | use crate::core::build_steps::compile::{ |
6 | 4 | add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make, |
7 | 5 | }; |
@@ -264,19 +262,23 @@ fn prepare_compiler_for_check( |
264 | 262 | build_compiler |
265 | 263 | } |
266 | 264 | Mode::ToolRustc | Mode::Codegen => { |
| 265 | + // FIXME: this is a hack, see description of Mode::Rustc below |
| 266 | + let stage = if host == target { builder.top_stage - 1 } else { builder.top_stage }; |
267 | 267 | // When checking tool stage N, we check it with compiler stage N-1 |
268 | | - let build_compiler = builder.compiler(builder.top_stage - 1, host); |
| 268 | + let build_compiler = builder.compiler(stage, host); |
269 | 269 | builder.ensure(Rustc::new(builder, build_compiler, target)); |
270 | 270 | build_compiler |
271 | 271 | } |
272 | 272 | Mode::Rustc => { |
273 | | - if builder.top_stage < 2 && host != target { |
274 | | - eprintln!("Cannot do a cross-compilation check of rustc on stage 1, use stage 2"); |
275 | | - exit!(1); |
276 | | - } |
277 | | - |
278 | | - // When checking the stage N compiler, we want to do it with the stage N-1 compiler |
279 | | - builder.compiler(builder.top_stage - 1, host) |
| 273 | + // This is a horrible hack, because we actually change the compiler stage numbering |
| 274 | + // here. If you do `x check --stage 1 --host FOO`, we build stage 1 host rustc, |
| 275 | + // and use that to check stage 1 FOO rustc (which actually makes that stage 2 FOO |
| 276 | + // rustc). |
| 277 | + // |
| 278 | + // FIXME: remove this and either fix cross-compilation check on stage 2 (which has a |
| 279 | + // myriad of other problems) or disable cross-checking on stage 1. |
| 280 | + let stage = if host == target { builder.top_stage - 1 } else { builder.top_stage }; |
| 281 | + builder.compiler(stage, host) |
280 | 282 | } |
281 | 283 | Mode::Std => { |
282 | 284 | // When checking std stage N, we want to do it with the stage N compiler |
|
0 commit comments