Skip to content

cargo miri test stopped working for doc tests #4323

Closed
@bluurryy

Description

@bluurryy

Since a recent nightly release cargo miri test errors if it is not run with the --lib flag.

To reproduce:

cargo new --lib cargo-miri-bug
cd cargo-miri-bug
cargo miri test --doc

Output:

fatal error: cross-interpreting doctests is not currently supported by Miri.
error: doctest failed, to rerun pass `--doc`

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri --edition=2024 --crate-type lib --color always --crate-name cargo_miri_bug --test src/lib.rs --test-run-directory /home/runner/work/cargo-miri-bug/cargo-miri-bug --target x86_64-unknown-linux-gnu --test-runtool /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri --test-runtool-arg runner -L dependency=/home/runner/work/cargo-miri-bug/cargo-miri-bug/target/miri/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/runner/work/cargo-miri-bug/cargo-miri-bug/target/miri/debug/deps --extern cargo_miri_bug=/home/runner/work/cargo-miri-bug/cargo-miri-bug/target/miri/x86_64-unknown-linux-gnu/debug/deps/libcargo_miri_bug-7afeea637ba9df55.rlib -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' --error-format human` (exit status: 1)
note: test exited abnormally; to see the full output pass --nocapture to the harness.

Versions:

> cargo -V
cargo 1.89.0-nightly (47c911e9e 2025-05-14)
> cargo miri -V
miri 0.1.0 (16d2276fa6 2025-05-16)

Here is an demo repo that fails ci:
https://github.com/bluurryy/cargo-miri-bug
https://github.com/bluurryy/cargo-miri-bug/actions/runs/15080920895/job/42397281329

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions