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

The job test-various failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test library/core/src/cell.rs - cell::Ref<'b,T>::map (line 1617) ... ok
test library/core/src/cell.rs - cell::Ref<'b,T>::map_split (line 1718) ... ok
test library/core/src/cell.rs - cell::RefCell<T>::as_ptr (line 1233) ... ok
test library/core/src/cell.rs - cell::RefCell<T>::borrow (line 1054) ... ok
Error: failed to run main module `/tmp/rustdoctestCTOsHA/rust_out.wasm`

Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
           0: 0x3b0352 - rust_out.wasm!abort
           1: 0x3a5e51 - rust_out.wasm!std::sys::pal::wasip1::helpers::abort_internal::ha2b90d1be7c86a08
           2: 0x3a14d7 - rust_out.wasm!std::process::abort::hfcd774854e6b1d65
           3: 0x3a1553 - rust_out.wasm!__rustc[27eca95895928fbd]::__rust_abort
           4: 0x3a12bb - rust_out.wasm!__rustc[27eca95895928fbd]::__rust_start_panic
           5: 0x3a12e0 - rust_out.wasm!__rustc[27eca95895928fbd]::rust_panic
           6: 0x3a903a - rust_out.wasm!std::panicking::panic_with_hook::h84936366d8e21bd5
           7: 0x3a747f - rust_out.wasm!std::panicking::panic_handler::{{closure}}::hc4f497859c2aa347
           8: 0x3a1642 - rust_out.wasm!std::sys::backtrace::__rust_end_short_backtrace::hbdcd4cf01fb4121a
           9: 0x3a1636 - rust_out.wasm!__rustc[27eca95895928fbd]::rust_begin_unwind
          10: 0x3b4f10 - rust_out.wasm!core::panicking::panic_fmt::h9bd1f024ab58537b
          11: 0x3c4806 - rust_out.wasm!core::cell::panic_already_mutably_borrowed::do_panic::runtime::h277e09dafbc20921
          12: 0x3c47a9 - rust_out.wasm!core::cell::panic_already_mutably_borrowed::hc1436beac87dd8f8
          13: 0x14dca3 - rust_out.wasm!core::cell::RefCell<T>::borrow::h9d744043f318116b
          14: 0x14dd69 - rust_out.wasm!doctest_bundle_2024::__doctest_74::main::h51cb57d953812f3e
          15: 0x14de39 - rust_out.wasm!doctest_bundle_2024::__doctest_74::__main_fn::h9e432e6be17450c0
          16: 0xd9bb - rust_out.wasm!doctest_runner_2024::__doctest_74::TEST::{{closure}}::hc29d541dccce526f
          17: 0xeaa32 - rust_out.wasm!core::ops::function::FnOnce::call_once::h4f4bf732362fb0d1
          18: 0x38ad8d - rust_out.wasm!test::__rust_begin_short_backtrace::hcb05ee0c812185d2
          19: 0x38aec7 - rust_out.wasm!test::types::RunnableTest::run::hffe6957e18abeb6c
          20: 0x398254 - rust_out.wasm!test::run_test::hd9f0988e79e6907c
          21: 0x394ba5 - rust_out.wasm!test::console::run_tests_console::hadf59cfe3b8c43fc
          22: 0x388020 - rust_out.wasm!test::test_main::hb2fc3dc6348af6b9
          23: 0xd9b4f - rust_out.wasm!doctest_runner_2024::main::h65670cafceb0e40c
          24: 0xda538 - rust_out.wasm!core::ops::function::FnOnce::call_once::h5d1857efefaca3bc
          25: 0xda2a0 - rust_out.wasm!std::sys::backtrace::__rust_begin_short_backtrace::h665e30e5d1895272
          26: 0xda288 - rust_out.wasm!std::rt::lang_start::{{closure}}::h525612ea53c1086e
          27: 0x3a491d - rust_out.wasm!std::rt::lang_start_internal::hc7fb360983abbb9c
          28: 0xda26a - rust_out.wasm!std::rt::lang_start::h7310e03079099877
          29: 0x10fbc8 - rust_out.wasm!__main_void
          30: 0xa5be - rust_out.wasm!_start
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    2: wasm trap: wasm `unreachable` instruction executed
WARNING: No rustdoc doctest environment variable provided so doctests will be run in the same process

running 2 tests
test library/core/src/primitive_docs.rs - prim_array (line 735) ... ok
test library/core/src/primitive_docs.rs - prim_array (line 792) ... ok
---
test library/core/src/time.rs - time::Duration::saturating_mul (line 805) ... ok

failures:

---- library/core/src/iter/traits/iterator.rs - iter::traits::iterator::Iterator::map_windows (line 1602) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/iter/traits/iterator.rs - iter::traits::iterator::Iterator::map_windows (line 1602) stdout end ----
---- library/core/src/num/int_macros.rs - num::i128::exact_div (line 1038) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i128::exact_div (line 1038) stdout end ----
---- library/core/src/num/int_macros.rs - num::i128::exact_div (line 1042) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i128::exact_div (line 1042) stdout end ----
---- library/core/src/num/int_macros.rs - num::i16::exact_div (line 1038) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i16::exact_div (line 1038) stdout end ----
---- library/core/src/num/int_macros.rs - num::i16::exact_div (line 1042) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i16::exact_div (line 1042) stdout end ----
---- library/core/src/num/int_macros.rs - num::i32::exact_div (line 1038) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i32::exact_div (line 1038) stdout end ----
---- library/core/src/num/int_macros.rs - num::i32::exact_div (line 1042) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i32::exact_div (line 1042) stdout end ----
---- library/core/src/num/int_macros.rs - num::i64::exact_div (line 1038) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i64::exact_div (line 1038) stdout end ----
---- library/core/src/num/int_macros.rs - num::i64::exact_div (line 1042) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i64::exact_div (line 1042) stdout end ----
---- library/core/src/num/int_macros.rs - num::i8::exact_div (line 1038) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i8::exact_div (line 1038) stdout end ----
---- library/core/src/num/int_macros.rs - num::i8::exact_div (line 1042) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::i8::exact_div (line 1042) stdout end ----
---- library/core/src/num/int_macros.rs - num::isize::exact_div (line 1038) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::isize::exact_div (line 1038) stdout end ----
---- library/core/src/num/int_macros.rs - num::isize::exact_div (line 1042) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/int_macros.rs - num::isize::exact_div (line 1042) stdout end ----
---- library/core/src/num/uint_macros.rs - num::u128::exact_div (line 1266) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/uint_macros.rs - num::u128::exact_div (line 1266) stdout end ----
---- library/core/src/num/uint_macros.rs - num::u16::exact_div (line 1266) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/uint_macros.rs - num::u16::exact_div (line 1266) stdout end ----
---- library/core/src/num/uint_macros.rs - num::u32::exact_div (line 1266) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/uint_macros.rs - num::u32::exact_div (line 1266) stdout end ----
---- library/core/src/num/uint_macros.rs - num::u64::exact_div (line 1266) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/uint_macros.rs - num::u64::exact_div (line 1266) stdout end ----
---- library/core/src/num/uint_macros.rs - num::u8::exact_div (line 1266) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/uint_macros.rs - num::u8::exact_div (line 1266) stdout end ----
---- library/core/src/num/uint_macros.rs - num::usize::exact_div (line 1266) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/num/uint_macros.rs - num::usize::exact_div (line 1266) stdout end ----
---- library/core/src/slice/index.rs - slice::index::range (line 874) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/slice/index.rs - slice::index::range (line 874) stdout end ----
---- library/core/src/slice/index.rs - slice::index::range (line 882) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/slice/index.rs - slice::index::range (line 882) stdout end ----
---- library/core/src/slice/index.rs - slice::index::range (line 890) stdout ----
Test didn't panic, but it's marked `should_panic` (got unexpected return code 134).
\ (no newline at end of output)
---- library/core/src/slice/index.rs - slice::index::range (line 890) stdout end ----

failures:
    library/core/src/iter/traits/iterator.rs - iter::traits::iterator::Iterator::map_windows (line 1602)
    library/core/src/num/int_macros.rs - num::i128::exact_div (line 1038)
    library/core/src/num/int_macros.rs - num::i128::exact_div (line 1042)

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-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.

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