Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Nemo157 opened this issue Feb 2, 2024 · 1 comment · Fixed by rust-lang/cargo#13388
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. A-panic Area: Panicking machinery C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Feb 2, 2024

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
@Nemo157 Nemo157 added C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. -Zbuild-std Unstable Cargo option: Compile the standard library yourself. A-panic Area: Panicking machinery labels Feb 2, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 2, 2024
@Nemo157
Copy link
Member Author

Nemo157 commented Feb 2, 2024

Manually telling rustdoc to use panic=abort gets the test to pass, so the second issue of having a broken panic-unwind might not actually matter, cargo just needs to be applying the -Zpanic-abort-tests changes to the doc-tests build too

RUSTDOCFLAGS='-Cpanic=abort --extern noprelude:panic_abort=/run/user/1000/cargo-home/target/shared/x86_64-unknown-linux-gnu/debug/deps/libpanic_abort-e6b0b85e7fbd4dec.rlib' cargo test --doc -Zbuild-std -Zpanic-abort-tests --config=profile.dev.panic='"abort"' --target=x86_64-unknown-linux-gnu

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. A-panic Area: Panicking machinery C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants