Skip to content

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

Closed
@jyn514

Description

@jyn514
Member

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

Activity

added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Mar 31, 2022
jyn514

jyn514 commented on Mar 31, 2022

@jyn514
MemberAuthor

x t --stage 0 compiler/rustc_llvm is also broken for unrelated reasons, so I suspect no one has ever tried running unit tests with --stage 0 before.

ehuss

ehuss commented on Mar 31, 2022

@ehuss
Contributor

The issue is that tests may use new syntax and features without needing #[cfg(bootstrap)]. For example, expect support was recently added in #87835 which isn't in beta.

I personally would just add a warning or error that tests may not work with stage0.

jyn514

jyn514 commented on May 6, 2022

@jyn514
MemberAuthor

This is fixed since the beta bump; closing since it sounds like doctests aren't supported on stage 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @ehuss@jyn514@rustbot

        Issue actions

          `x test --stage 0 --doc compiler/rustc_lint_defs` fails · Issue #95515 · rust-lang/rust