Skip to content

Failure to build doc-tests when combining panic=abort, panic-abort-tests and build-std #120578

Closed
rust-lang/cargo
#13388
@Nemo157

Description

@Nemo157

I tried this code:

//! ```should_panic
//! panic!();
//! ```
> cargo test --doc -Zbuild-std -Zpanic-abort-tests --config=profile.dev.panic='"abort"' --target=x86_64-unknown-linux-gnu

I expected to see this happen: successful test run using panic_abort

Instead, this happened:

---- src/lib.rs - (line 1) stdout ----
error: the crate `panic_unwind` does not have the panic strategy `unwind`

error: aborting due to 1 previous error

Couldn't compile the test.

There seems to be a couple of issues here, the panic=abort doesn't seem to be applied to rustdoc, so it still uses the panic_unwind runtime, and for some reason that runtime has been broken when -Cpanic=abort is active.

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (098d4fd74 2024-01-16)
binary: rustc
commit-hash: 098d4fd74c078b12bfc2e9438a2a04bc18b393bc
commit-date: 2024-01-16
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zbuild-stdUnstable Cargo option: Compile the standard library yourself.A-panicArea: Panicking machineryC-bugCategory: This is a bug.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions