Skip to content

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Oct 14, 2025

Fixes #143009.
Fixes #143858.

Supersedes #143900.

For --no-run, we forgot to check the "global" options in the 2024 edition, fixed in the first commit.

For should_panic fix, the exit code check has been fixed.

r? @fmease

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2025

fmease is currently at their maximum review capacity.
They may take a while to respond.

@GuillaumeGomez
Copy link
Member Author

Let's see if it works like that, otherwise I'll add some cfg(bootstrap) around. Locally with stage 2 it worked fine.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

Ah right, forgot to fix std doc examples.

@GuillaumeGomez
Copy link
Member Author

Checking all previously failing CIs.

@bors try jobs=armhf-gnu,test-various,x86_64-gnu-aux

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 15, 2025
[rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-gnu-aux
@rust-bors
Copy link

rust-bors bot commented Oct 15, 2025

💔 Test for 0c093af failed: CI. Failed jobs:

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

So the error comes from the fact that should_panic is ignored on some platforms by libtest and rustdoc didn't do this check. I added it as well.

Let's try again.

@bors try jobs=armhf-gnu,test-various,x86_64-gnu-aux

@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Oct 16, 2025

💔 Test for c5583f8 failed: CI. Failed jobs:

@GuillaumeGomez
Copy link
Member Author

Not ready yet! Just more cleanups before my next attempt: if should_panic (and not compile_fail), then we compile a binary with libtest to ensure we can actually run this test and if so, we call the other code.

@GuillaumeGomez
Copy link
Member Author

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 18, 2025
[rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition

try-job: test-various
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Oct 18, 2025

💔 Test for 8d12b29 failed: CI. Failed jobs:

@fmease fmease added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2025
@GuillaumeGomez
Copy link
Member Author

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 18, 2025
[rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition

try-job: test-various
@rust-log-analyzer

This comment has been minimized.

@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 Oct 18, 2025
@GuillaumeGomez
Copy link
Member Author

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 18, 2025
[rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition

try-job: test-various
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Oct 18, 2025

💔 Test for 5ab1076 failed: CI. Failed jobs:

@GuillaumeGomez
Copy link
Member Author

@bors try jobs=test-various

@rust-bors
Copy link

rust-bors bot commented Oct 19, 2025

⌛ Trying commit 11458ed with merge 47b600c

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/18627627947

rust-bors bot added a commit that referenced this pull request Oct 19, 2025
[rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition

try-job: test-various
@rust-log-analyzer
Copy link
Collaborator

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

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

---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0454 (line 8677) stdout ----
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "/tmp/rustcNJ7yl5/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "-lsome_lib" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcNJ7yl5/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/tmp/rustdoctestdruNke/rust_out" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: cannot find -lsome_lib: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0459 (line 8781) stdout ----
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "/tmp/rustchqpLuH/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "-lsome_lib" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustchqpLuH/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/tmp/rustdoctesturZwjg/rust_out" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: cannot find -lsome_lib: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0539 (line 11381) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11386:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11381_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0542 (line 11486) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11491:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11486_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0543 (line 11532) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11537:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11532_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0544 (line 11569) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11574:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11569_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0545 (line 11605) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11610:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11605_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0546 (line 11643) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11648:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11643_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0547 (line 11681) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11686:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11681_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---- /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0549 (line 11724) stdout ----
error: function has missing stability attribute
##[error] --> /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md:11729:1
  |
7 | pub fn main() { #[allow(non_snake_case)] fn _doctest_main__checkout_obj_build_aarch64_unknown_linux_gnu_test_error_index_md_11724_0() {
  | ^^^^^^^^^^^^^

error: aborting due to 1 previous error

Couldn't compile the test.
---
    /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0549 (line 11724)

test result: FAILED. 1031 passed; 10 failed; 73 ignored; 0 measured; 0 filtered out; finished in 24.43s

Command `/checkout/obj/build/bootstrap/debug/rustdoc -Wrustdoc::invalid_codeblock_attributes -Dwarnings -Znormalize-docs -Z unstable-options --test /checkout/obj/build/aarch64-unknown-linux-gnu/test/error-index.md --test-args ` failed with exit code 101
Created at: src/bootstrap/src/core/builder/mod.rs:1693:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:2719:13

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 0:32:38
  local time: Sun Oct 19 08:47:02 UTC 2025
  network time: Sun, 19 Oct 2025 08:47:02 GMT
##[error]Process completed with exit code 1.

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

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. 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.

Rustdoc --no-run runs when --edition=2024 is provided should_panic in doctests accepts crashes, aborts, std::process::exit

4 participants