Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jyn514 opened this issue Mar 31, 2022 · 3 comments
Closed

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

jyn514 opened this issue Mar 31, 2022 · 3 comments
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 31, 2022

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

@jyn514 jyn514 added the C-bug Category: This is a bug. label Mar 31, 2022
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Mar 31, 2022
@jyn514
Copy link
Member Author

jyn514 commented Mar 31, 2022

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
Copy link
Contributor

ehuss commented Mar 31, 2022

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
Copy link
Member Author

jyn514 commented May 6, 2022

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

@jyn514 jyn514 closed this as completed May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

3 participants