File tree Expand file tree Collapse file tree 5 files changed +13
-10
lines changed Expand file tree Collapse file tree 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 {
283283 }
284284
285285 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 ) ;
287287 let target = self . target;
288288
289289 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 {
951951 // Rustdoc needs the rustc sysroot available to build.
952952 // FIXME: is there a way to only ensure `check::Rustc` here? Last time I tried it failed
953953 // 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 ) ;
955955 }
956956
957957 // Build cargo command.
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ pub fn prepare_tool_cargo(
180180 extra_features : & [ String ] ,
181181) -> CargoCommand {
182182 // 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 ( ) {
184184 // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
185185 // we'd have stageN/bin/rustc and stageN/bin/$tool_name be effectively different stage
186186 // compilers, which isn't what we want.
@@ -630,8 +630,8 @@ impl Step for Rustdoc {
630630 let compiler = self . compiler ;
631631 let target = compiler. host ;
632632
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) {
635635 panic ! ( "rustdoc in stage 0 must be snapshot rustdoc" ) ;
636636 }
637637 return builder. initial_rustdoc . clone ( ) ;
Original file line number Diff line number Diff line change @@ -1244,8 +1244,6 @@ impl<'a> Builder<'a> {
12441244
12451245 // FIXME: remove stage check
12461246 if stage > 0 && downgrade_for_rustc_tool {
1247- assert ! ( stage > 0 , "can't downgrade stage 0 compiler" ) ;
1248-
12491247 self . ensure ( compile:: Std :: new ( compiler, host) ) ;
12501248 // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
12511249 // we'd have stageN/bin/rustc and stageN/bin/$tool_name be effectively different stage
@@ -1415,8 +1413,12 @@ impl<'a> Builder<'a> {
14151413 }
14161414
14171415 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" ) ;
14201422 compiler. downgrade ( ) ;
14211423 }
14221424
Original file line number Diff line number Diff line change @@ -106,8 +106,9 @@ impl std::hash::Hash for Compiler {
106106
107107impl PartialEq for Compiler {
108108 fn eq ( & self , other : & Self ) -> bool {
109- // FIXME: cover `downgraded_from` for test env
110109 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 )
111112 }
112113}
113114
You can’t perform that action at this time.
0 commit comments