-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[-Zbuild-std] Duplicate lang item error for no-harness test and profile.dev.panic = abort #7359
Comments
I think this is covered by rust-lang/wg-cargo-std-aware#29 for now where |
I don't think that any crates are compiled with unwinding in this example because the target itself specfies As another data point, I was able to successfully run Feel free to close this in favor of the working group issue if you like. |
Oh true yeah, but Cargo compiles one with |
I'm seeing same error even without I'm not sure what are the platform differences, but so far none of custom The closest I got was passing
because some crates like Crossbeam use cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
} and I'm not sure how to disable that check either. |
@RReverser that's a too-old version of Cargo, that issue should be fixed in nightlies. |
This is exactly the problem you described for what I encountered, and still not working using the latest version of nightly Rust as of the date of this comment. |
I can reproduce this with latest nightly, with just |
The various changes over the last year or so broke testing with cargo xtest, but we can now use cargo test instead. Note that we had to remove the (admittedly redundant) declarations of `panic = "abort"` in both `dev` and `release` profiles in Cargo.toml, thanks to rust-lang/cargo#7359. The only thing left is the repeated deprecation warning from bootloader, tracked in rust-osdev/bootloader#107, which needs to be reopend at time of writing.
The various changes over the last year or so broke testing with cargo xtest, but we can now use cargo test instead. Note that we had to remove the (admittedly redundant) declarations of `panic = "abort"` in both `dev` and `release` profiles in Cargo.toml, thanks to rust-lang/cargo#7359. The only thing left is the repeated deprecation warning from bootloader, tracked in rust-osdev/bootloader#107, which needs to be reopend at time of writing.
This commit removes all instances of `panic = "abort"` directives in the Cargo manifest in order to mitigate Cargo bug [#7359](rust-lang/cargo#7359) so that the test suite can run.
The various changes over the last year or so broke testing with cargo xtest, but we can now use cargo test instead. Note that we had to remove the (admittedly redundant) declarations of `panic = "abort"` in both `dev` and `release` profiles in Cargo.toml, thanks to rust-lang/cargo#7359. The only thing left is the repeated deprecation warning from bootloader, tracked in rust-osdev/bootloader#107, which needs to be reopend at time of writing. Signed-off-by: SlyMarbo <the.sly.marbo@googlemail.com>
The various changes over the last year or so broke testing with cargo xtest, but we can now use cargo test instead. Note that we had to remove the (admittedly redundant) declarations of `panic = "abort"` in both `dev` and `release` profiles in Cargo.toml, thanks to rust-lang/cargo#7359. The only thing left is the repeated deprecation warning from bootloader, tracked in rust-osdev/bootloader#107, which needs to be reopend at time of writing. Signed-off-by: SlyMarbo <the.sly.marbo@googlemail.com>
The various changes over the last year or so broke testing with cargo xtest, but we can now use cargo test instead. Note that we had to remove the (admittedly redundant) declarations of `panic = "abort"` in both `dev` and `release` profiles in Cargo.toml, thanks to rust-lang/cargo#7359. The only thing left is the repeated deprecation warning from bootloader, tracked in rust-osdev/bootloader#107, which needs to be reopend at time of writing. Signed-off-by: SlyMarbo <the.sly.marbo@googlemail.com>
I can still repro the error reported by @phil-opp with latest rust nightly and cargo. Here is a test project: https://github.com/TisnKu/rust-duplicat-lang-item-test Test commandcargo test --target target.json -Z build-std=core --no-run Error:
rustc +nightly -Vrustc 1.62.0-nightly (8bf93e9b6 2022-04-09) cargo -Vcargo 1.62.0-nightly (e2e2ddd 2022-04-05) rustup showDefault host: aarch64-apple-darwin installed toolchainsstable-aarch64-apple-darwin (default) installed targets for active toolchainaarch64-apple-darwin active toolchainnightly-aarch64-apple-darwin (directory override for '/Users/txku/projects/foo') |
Base on: rust-lang/cargo#7359 disable `panic=abort` in Cargo.toml Others: 1. remove exmaple/
I have this simple project: https://github.com/crumblingstatue/kbswitch
|
Can't figure out how to implement panic enough to satisfy cargo, but this works.
Currently, the Rust panic strategy is specified redundantly at two different locations: once in the Cargo.toml manifest and once more in the svsm-target.json target definition. This by itself is not a problem, but there's a Rust issue open ([1]), which would cause odd build errors upon 'cargo test' invocations. Removing the panic strategy specification from Cargo.toml magically makes everything work. So do that. [1] rust-lang/cargo#7359 Signed-off-by: Nicolai Stange <nstange@suse.de>
- isa-debug qemu exit - serial/uart out (panics and headless ops) - vga out - custom tests - "temporarily" removed panic=abort from Cargo.toml, until [this](rust-lang/cargo#7359) gets fixed
Combining a no-harness test with a
panic=abort
key in the Cargo.toml leads to duplicate lang item errors if compiled withcargo test -Zbuild-std=core
.Steps to Reproduce
Create a new cargo project with the following contents:
Cargo.toml
:src/lib.rs
:target.json
:Run
cargo test --target target.json -Z build-std=core --no-run
The following error occurs:
Remove the
panic=abort
line from the Cargo.tomlRerun the command from step 2 (
cargo test --target target.json -Z build-std=core --no-run
). It works now.My Guess
My guess is that the
core
library is somehow compiled twice when thepanic=abort
line is specified.Version
cargo 1.39.0-nightly (fe0e5a4 2019-09-04)
The text was updated successfully, but these errors were encountered: