File tree 5 files changed +13
-10
lines changed
5 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ macro_rules! lint_any {
283
283
}
284
284
285
285
fn run( self , builder: & Builder <' _>) -> Self :: Output {
286
- let compiler = builder. compiler( builder. top_stage, builder. config. build, $mode == Mode :: ToolRustc ) ;
286
+ let compiler = builder. compiler( builder. top_stage, builder. config. build, builder . top_stage > 0 && $mode == Mode :: ToolRustc ) ;
287
287
let target = self . target;
288
288
289
289
builder. ensure( check:: Rustc :: new( target, builder) . build_kind( Some ( Kind :: Check ) ) ) ;
Original file line number Diff line number Diff line change @@ -951,7 +951,7 @@ macro_rules! tool_doc {
951
951
// Rustdoc needs the rustc sysroot available to build.
952
952
// FIXME: is there a way to only ensure `check::Rustc` here? Last time I tried it failed
953
953
// with strange errors, but only on a full bors test ...
954
- let _ = builder. compiler( compiler. stage, target, false ) ;
954
+ let _ = builder. compiler( compiler. stage, target, true ) ;
955
955
}
956
956
957
957
// Build cargo command.
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ pub fn prepare_tool_cargo(
180
180
extra_features : & [ String ] ,
181
181
) -> CargoCommand {
182
182
// FIXME: remove stage check
183
- if mode == Mode :: ToolRustc && !compiler. is_downgraded_already ( ) && compiler . stage != 0 {
183
+ if builder . top_stage > 0 && mode == Mode :: ToolRustc && !compiler. is_downgraded_already ( ) {
184
184
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
185
185
// we'd have stageN/bin/rustc and stageN/bin/$tool_name be effectively different stage
186
186
// compilers, which isn't what we want.
@@ -630,8 +630,8 @@ impl Step for Rustdoc {
630
630
let compiler = self . compiler ;
631
631
let target = compiler. host ;
632
632
633
- if compiler. stage == 0 {
634
- if !compiler. is_snapshot ( builder) && !compiler . is_downgraded_already ( ) {
633
+ if compiler. stage == 0 && !compiler . is_downgraded_already ( ) {
634
+ if !compiler. is_snapshot ( builder) {
635
635
panic ! ( "rustdoc in stage 0 must be snapshot rustdoc" ) ;
636
636
}
637
637
return builder. initial_rustdoc . clone ( ) ;
Original file line number Diff line number Diff line change @@ -1244,8 +1244,6 @@ impl<'a> Builder<'a> {
1244
1244
1245
1245
// FIXME: remove stage check
1246
1246
if stage > 0 && downgrade_for_rustc_tool {
1247
- assert ! ( stage > 0 , "can't downgrade stage 0 compiler" ) ;
1248
-
1249
1247
self . ensure ( compile:: Std :: new ( compiler, host) ) ;
1250
1248
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
1251
1249
// we'd have stageN/bin/rustc and stageN/bin/$tool_name be effectively different stage
@@ -1415,8 +1413,12 @@ impl<'a> Builder<'a> {
1415
1413
}
1416
1414
1417
1415
pub fn rustdoc ( & self , mut compiler : Compiler ) -> PathBuf {
1418
- // FIXME: remove stage check
1419
- if compiler. stage > 0 && !compiler. is_downgraded_already ( ) {
1416
+ if compiler. is_snapshot ( self ) && !compiler. is_downgraded_already ( ) {
1417
+ return self . initial_rustc . with_file_name ( exe ( "rustdoc" , compiler. host ) ) ;
1418
+ }
1419
+
1420
+ if !compiler. is_downgraded_already ( ) {
1421
+ assert ! ( compiler. stage > 0 , "Can't use stage0 compiler for rustdoc" ) ;
1420
1422
compiler. downgrade ( ) ;
1421
1423
}
1422
1424
Original file line number Diff line number Diff line change @@ -106,8 +106,9 @@ impl std::hash::Hash for Compiler {
106
106
107
107
impl PartialEq for Compiler {
108
108
fn eq ( & self , other : & Self ) -> bool {
109
- // FIXME: cover `downgraded_from` for test env
110
109
self . stage == other. stage && self . host == other. host
110
+ // We have coverage for `downgraded_from` in our unit tests
111
+ && ( !cfg ! ( test) || self . downgraded_from == other. downgraded_from )
111
112
}
112
113
}
113
114
You can’t perform that action at this time.
0 commit comments