Do not run lint-docs tests in stage 1 x test by default

This commit is contained in:
Jakub Beránek 2025-08-27 11:38:39 +02:00
parent 9de09ac101
commit 5bc9308471
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
2 changed files with 10 additions and 14 deletions

View file

@ -2693,7 +2693,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
/// which have their own separate test steps.)
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CrateLibrustc {
/// The compiler that will *build* rustc in test mode.
/// The compiler that will run unit tests and doctests on the in-tree rustc source.
build_compiler: Compiler,
target: TargetSelection,
crates: Vec<String>,
@ -3429,24 +3429,22 @@ impl Step for LintDocs {
const IS_HOST: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/lint-docs")
let stage = run.builder.top_stage;
// Lint docs tests might not work with stage 1, so do not run this test by default in
// `x test` below stage 2.
run.path("src/tools/lint-docs").default_condition(stage > 1)
}
fn make_run(run: RunConfig<'_>) {
// Bump the stage to 2, because the rustc book requires an in-tree compiler.
// At the same time, since this step is enabled by default, we don't want `x test` to fail
// in stage 1.
let stage = if run.builder.config.is_explicit_stage() || run.builder.top_stage >= 2 {
run.builder.top_stage
} else {
2
};
if run.builder.top_stage < 2 {
eprintln!("WARNING: lint-docs tests might not work below stage 2");
}
run.builder.ensure(LintDocs {
build_compiler: prepare_doc_compiler(
run.builder,
run.builder.config.host_target,
stage,
run.builder.top_stage,
),
target: run.target,
});

View file

@ -2111,8 +2111,6 @@ mod snapshot {
[test] link-check <host>
[test] tier-check <host>
[test] rustc 0 <host> -> rust-analyzer 1 <host>
[doc] rustc (book) <host>
[test] rustc 1 <host> -> lint-docs 2 <host>
[build] rustc 0 <host> -> RustdocTheme 1 <host>
[test] rustdoc-theme 1 <host>
[test] RustdocUi <host>
@ -2175,7 +2173,7 @@ mod snapshot {
[doc] book/second-edition (book) <host>
[doc] book/2018-edition (book) <host>
[doc] rustc 1 <host> -> standalone 2 <host>
[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]
[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]
[build] rustc 1 <host> -> error-index 2 <host>
[doc] rustc 1 <host> -> error-index 2 <host>
[doc] nomicon (book) <host>