Skip to content

fix running stdlib doctests in Miri in CI - #150458

Merged
bors merged 2 commits into
rust-lang:mainfrom
RalfJung:miri-doctests
Dec 29, 2025
Merged

fix running stdlib doctests in Miri in CI#150458
bors merged 2 commits into
rust-lang:mainfrom
RalfJung:miri-doctests

Conversation

@RalfJung

Copy link
Copy Markdown
Member

@rustbotrustbot added 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 Dec 28, 2025
$(BOOTSTRAP) miri --stage 2 \
library/coretests \
library/alloctests \
library/core \

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is wired up to run the tests from the separate crates, right?

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.

I don't think that is implemented for ./x.py miri. ./x.py test has this code:

// The core and alloc crates can't directly be tested. We
// could silently ignore them, but adding their own test
// crates is less confusing for users. We still keep core and
// alloc themself for doctests
if crates.iter().any(|crate_| crate_ == "core"){
crates.push("coretests".to_owned());
}
if crates.iter().any(|crate_| crate_ == "alloc"){
crates.push("alloctests".to_owned());
}
But ./x.py miri doesn't.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That code also runs for ./x miri though?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I tried ./x miri library/core -- mem and it said

 Running tests/lib.rs (build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/debug/deps/coretests-d8eae4d2db388c62)
running 71 tests
.......................................................................
test result: ok. 71 passed; 0 failed; 0 ignored; 0 measured; 2201 filtered out; finished in 24.46s
Running benches/lib.rs (build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/debug/deps/corebenches-41b71a0680fbdcd6)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 29.49ms
Doc-tests core
running 113 tests
........................................................................................ 88/113
.........................
test result: ok. 113 passed; 0 failed; 0 ignored; 0 measured; 5467 filtered out; finished in 2.43s
all doctests ran in 2.50s; merged doctests compilation took 0.04s
Doc-tests coretests
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 12.47µs
finished in 55.808 seconds

That looks good to me?

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.

Indeed. I was looking at build_steps::test::Miri, which is for ./x.py test src/tools/miri, not ./x.py miri.

@RalfJung

Copy link
Copy Markdown
MemberAuthor

@bors try jobs=miri

@rust-bors

This comment has been minimized.

rust-borsBot added a commit that referenced this pull request Dec 28, 2025
fix running doctests in Miri
try-job: *miri*
@rust-bors

rust-borsBot commented Dec 28, 2025

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d178db9 (d178db9e5a55eda3463e86f358ad4f5d0deccf2f, parent: 23d01cd2412583491621ab1ca4f1b01e37d11e39)

@RalfJung

Copy link
Copy Markdown
MemberAuthor

That is very strange, I expected the try build to fail since there's a broken doctest...

@RalfJung

Copy link
Copy Markdown
MemberAuthor

Oh wait, that was the wrong job.

@bors try jobs=aux

@rust-bors

This comment has been minimized.

rust-borsBot added a commit that referenced this pull request Dec 28, 2025
fix running doctests in Miri
try-job: *aux*
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-aux failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)
 |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main::_doctest_main_library_core_src_mem_maybe_dangling_rs_39_0` at library/core/src/mem/maybe_dangling.rs:15:13: 15:18
note: inside `main`
--> library/core/src/mem/maybe_dangling.rs:52:3
|
52 | } _doctest_main_library_core_src_mem_maybe_dangling_rs_39_0() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())`
--> /checkout/library/core/src/ops/function.rs:250:5
|
250 | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
---
all doctests ran in 505.29s; merged doctests compilation took 0.05s
error: doctest failed, to rerun pass `-p core --doc`
Bootstrap failed while executing `miri --stage 2 library/core library/alloc --doc`
Build completed unsuccessfully in 0:09:46
make: *** [Makefile:56: check-aux] Error 1
local time: Sun Dec 28 17:08:16 UTC 2025
network time: Sun, 28 Dec 2025 17:08:16 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@rust-bors

rust-borsBot commented Dec 28, 2025

Copy link
Copy Markdown
Contributor

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

@RalfJung

Copy link
Copy Markdown
MemberAuthor

Nice. And now it should be fixed.

@bors try jobs=aux

@rust-bors

This comment has been minimized.

rust-borsBot added a commit that referenced this pull request Dec 28, 2025
fix running doctests in Miri
try-job: *aux*
@rust-bors

rust-borsBot commented Dec 28, 2025

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 084978e (084978ecbaddcb161b9963a2408f2382a918b993, parent: 7eadf834b536d0659c7445e2b0970316b55abde4)

@RalfJungRalfJung changed the title fix running doctests in Mirifix running stdlib doctests in Miri in CIDec 28, 2025
@bjorn3

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Dec 29, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit a4b4cd5 has been approved by bjorn3

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 29, 2025
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Dec 29, 2025
fix running stdlib doctests in Miri in CI
r? ``@bjorn3``
bors added a commit that referenced this pull request Dec 29, 2025
Rollup of 6 pull requests
Successful merges:
- #150108 (Offload: Build offload as a single Step)
- #150262 (slice iter cleanup: replace checked_sub with saturating_sub)
- #150427 (add has_offload/needs-offload to the test infra)
- #150458 (fix running stdlib doctests in Miri in CI)
- #150477 (Fix enum variant suggestion consuming trailing parenthesis)
- #150478 (Fix new bors config)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit fc8230f into rust-lang:mainDec 29, 2025
23 checks passed
@rustbotrustbot added this to the 1.94.0 milestone Dec 29, 2025
rust-timer added a commit that referenced this pull request Dec 29, 2025
Rollup merge of #150458 - RalfJung:miri-doctests, r=bjorn3
fix running stdlib doctests in Miri in CI
r? `@bjorn3`
@RalfJung
RalfJung deleted the miri-doctests branch January 1, 2026 11:33
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jan 2, 2026
Rollup of 6 pull requests
Successful merges:
- rust-lang/rust#150108 (Offload: Build offload as a single Step)
- rust-lang/rust#150262 (slice iter cleanup: replace checked_sub with saturating_sub)
- rust-lang/rust#150427 (add has_offload/needs-offload to the test infra)
- rust-lang/rust#150458 (fix running stdlib doctests in Miri in CI)
- rust-lang/rust#150477 (Fix enum variant suggestion consuming trailing parenthesis)
- rust-lang/rust#150478 (Fix new bors config)
r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@RalfJung@rust-log-analyzer@bjorn3@bors@rustbot