@@ -2695,7 +2695,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
26952695/// which have their own separate test steps.)
26962696#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
26972697pub struct CrateLibrustc {
2698- /// The compiler that will *build* rustc in test mode .
2698+ /// The compiler that will run unit tests and doctests on the in-tree rustc source .
26992699 build_compiler : Compiler ,
27002700 target : TargetSelection ,
27012701 crates : Vec < String > ,
@@ -3431,24 +3431,22 @@ impl Step for LintDocs {
34313431 const IS_HOST : bool = true ;
34323432
34333433 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
3434- run. path ( "src/tools/lint-docs" )
3434+ let stage = run. builder . top_stage ;
3435+ // Lint docs tests might not work with stage 1, so do not run this test by default in
3436+ // `x test` below stage 2.
3437+ run. path ( "src/tools/lint-docs" ) . default_condition ( stage > 1 )
34353438 }
34363439
34373440 fn make_run ( run : RunConfig < ' _ > ) {
3438- // Bump the stage to 2, because the rustc book requires an in-tree compiler.
3439- // At the same time, since this step is enabled by default, we don't want `x test` to fail
3440- // in stage 1.
3441- let stage = if run. builder . config . is_explicit_stage ( ) || run. builder . top_stage >= 2 {
3442- run. builder . top_stage
3443- } else {
3444- 2
3445- } ;
3441+ if run. builder . top_stage < 2 {
3442+ eprintln ! ( "WARNING: lint-docs tests might not work below stage 2" ) ;
3443+ }
34463444
34473445 run. builder . ensure ( LintDocs {
34483446 build_compiler : prepare_doc_compiler (
34493447 run. builder ,
34503448 run. builder . config . host_target ,
3451- stage ,
3449+ run . builder . top_stage ,
34523450 ) ,
34533451 target : run. target ,
34543452 } ) ;
0 commit comments