Skip to content

Prevent --test to be used in rustdoc-html testsuite - #162030

Open
GuillaumeGomez wants to merge 4 commits into
rust-lang:mainfrom
GuillaumeGomez:forbid-test-rustdoc-html
Open

Prevent --test to be used in rustdoc-html testsuite#162030
GuillaumeGomez wants to merge 4 commits into
rust-lang:mainfrom
GuillaumeGomez:forbid-test-rustdoc-html

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

As promised.

CI will fail until #162014 is merged though.

r? @fmease

@rustbot

rustbot commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added the A-compiletest Area: The compiletest test runner label Aug 30, 2026
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 30, 2026
@fmease fmease added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2026

@fmease fmease left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me once unblocked

As I've mentioned in #162014 (review) rejecting tests w/o any HtmlDocCk directives instead (someday in the future) might even be more helpful.

View changes since this review

pub(super) fn run_rustdoc_html_test(&self) {
assert!(self.variant.revision.is_none(), "revisions not supported in this test suite");

if self.props.compile_flags.iter().any(|s| s == "--test") {

@fmease fmease Aug 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For onlookers: We already do this sort of thing in compiletest, i.e., going through the compile flags to forbid certain ones (see --edition for example).

pub(super) fn run_rustdoc_html_test(&self) {
assert!(self.variant.revision.is_none(), "revisions not supported in this test suite");

if self.props.compile_flags.iter().any(|s| s == "--test") {

@fmease fmease Aug 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People can accidentally bypass this check by using //@ doc-flags (for the record, you shouldn't use it for flags that are also supported by rustc but, oh well, that won't stop anyone).

Anyways, doesn't really matter. Feel free to implement or ignore that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good idea.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the forbid-test-rustdoc-html branch from 3588207 to fa9cd5b Compare August 31, 2026 16:32
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Aug 31, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the forbid-test-rustdoc-html branch from 8a20a9c to 5c99f49 Compare August 31, 2026 17:40
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [rustdoc-html] tests/rustdoc-html/async/async-move-doctest.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/async/async-move-doctest.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/async/async-move-doctest.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/comment-in-doctest.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/comment-in-doctest.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/comment-in-doctest.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/demo-allocator-54478.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/demo-allocator-54478.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/demo-allocator-54478.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/doc-test-attr-18199.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/doc-test-attr-18199.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/doc-test-attr-18199.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/edition-doctest.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/edition-doctest.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/edition-doctest.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/edition-flag.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/edition-flag.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/edition-flag.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/ice-type-error-19181.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/ice-type-error-19181.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/ice-type-error-19181.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/process-termination.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/process-termination.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/process-termination.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/test_option_check/bar.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/test_option_check/bar.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/test_option_check/bar.rs stdout end ----
---- [rustdoc-html] tests/rustdoc-html/test_option_check/test.rs stdout ----

thread '[rustdoc-html] tests/rustdoc-html/test_option_check/test.rs' panicked at src/tools/compiletest/src/runtest/rustdoc.rs:13:13:
If you want to check `--test`, put this test into `rustdoc-ui` testsuite instead
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [rustdoc-html] tests/rustdoc-html/test_option_check/test.rs stdout end ----

failures:
    [rustdoc-html] tests/rustdoc-html/async/async-move-doctest.rs

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Now we wait for #162014 to be merged.

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

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants