Skip to content

x test --stage 0 --doc compiler/rustc_lint_defs fails #95515

Closed
@jyn514

Description

@jyn514

I found this originally while testing out #95445, but it's also present on master.

I tried this code: x test --stage 0 --doc compiler/rustc_lint_defs
I expected to see this happen: Tests pass, like they do for --stage 1.

Instead, this happened:

   Doc-tests rustc_lint_defs

running 106 tests
ii..........i..i.....i......i.ii.i.......i......iii.....................i.F......i..i.............i. 100/106
......
failures:

---- src/builtin.rs - builtin::UNFULFILLED_LINT_EXPECTATIONS (line 503) stdout ----
error: cannot find attribute `expect` in this scope
 --> src/builtin.rs:506:3
  |
5 | #[expect(unused_variables)]
  |   ^^^^^^

error: aborting due to previous error

Couldn't compile the test.

failures:
    src/builtin.rs - builtin::UNFULFILLED_LINT_EXPECTATIONS (line 503)

test result: FAILED. 88 passed; 1 failed; 17 ignored; 0 measured; 0 filtered out; finished in 2.42s

It's unclear to me whether this is a bug in bootstrap / rustdoc / rustc_lint_defs, or whether doc-tests for the compiler just don't support --stage 0? If so I could add a warning the same way compiletest warns:

rust/src/bootstrap/test.rs

Lines 1261 to 1269 in 05d2221

if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() {
eprintln!("\
error: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail
help: to test the compiler, use `--stage 1` instead
help: to test the standard library, use `--stage 0 library/std` instead
note: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`."
);
std::process::exit(1);
}

cc @Mark-Simulacrum in case you have ideas.

Meta

HEAD is 11909e3.

@rustbot label +A-rustbuild

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions