Skip to content

Commit 5bc9308

Browse files
committed
Do not run lint-docs tests in stage 1 x test by default
1 parent 9de09ac commit 5bc9308

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
26932693
/// which have their own separate test steps.)
26942694
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
26952695
pub struct CrateLibrustc {
2696-
/// The compiler that will *build* rustc in test mode.
2696+
/// The compiler that will run unit tests and doctests on the in-tree rustc source.
26972697
build_compiler: Compiler,
26982698
target: TargetSelection,
26992699
crates: Vec<String>,
@@ -3429,24 +3429,22 @@ impl Step for LintDocs {
34293429
const IS_HOST: bool = true;
34303430

34313431
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
3432-
run.path("src/tools/lint-docs")
3432+
let stage = run.builder.top_stage;
3433+
// Lint docs tests might not work with stage 1, so do not run this test by default in
3434+
// `x test` below stage 2.
3435+
run.path("src/tools/lint-docs").default_condition(stage > 1)
34333436
}
34343437

34353438
fn make_run(run: RunConfig<'_>) {
3436-
// Bump the stage to 2, because the rustc book requires an in-tree compiler.
3437-
// At the same time, since this step is enabled by default, we don't want `x test` to fail
3438-
// in stage 1.
3439-
let stage = if run.builder.config.is_explicit_stage() || run.builder.top_stage >= 2 {
3440-
run.builder.top_stage
3441-
} else {
3442-
2
3443-
};
3439+
if run.builder.top_stage < 2 {
3440+
eprintln!("WARNING: lint-docs tests might not work below stage 2");
3441+
}
34443442

34453443
run.builder.ensure(LintDocs {
34463444
build_compiler: prepare_doc_compiler(
34473445
run.builder,
34483446
run.builder.config.host_target,
3449-
stage,
3447+
run.builder.top_stage,
34503448
),
34513449
target: run.target,
34523450
});

src/bootstrap/src/core/builder/tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,8 +2111,6 @@ mod snapshot {
21112111
[test] link-check <host>
21122112
[test] tier-check <host>
21132113
[test] rustc 0 <host> -> rust-analyzer 1 <host>
2114-
[doc] rustc (book) <host>
2115-
[test] rustc 1 <host> -> lint-docs 2 <host>
21162114
[build] rustc 0 <host> -> RustdocTheme 1 <host>
21172115
[test] rustdoc-theme 1 <host>
21182116
[test] RustdocUi <host>
@@ -2175,7 +2173,7 @@ mod snapshot {
21752173
[doc] book/second-edition (book) <host>
21762174
[doc] book/2018-edition (book) <host>
21772175
[doc] rustc 1 <host> -> standalone 2 <host>
2178-
[doc] rustc 2 <host> -> std 2 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
2176+
[doc] rustc 1 <host> -> std 1 <host> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
21792177
[build] rustc 1 <host> -> error-index 2 <host>
21802178
[doc] rustc 1 <host> -> error-index 2 <host>
21812179
[doc] nomicon (book) <host>

0 commit comments

Comments
 (0)