You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo bench fails to compile when using build-std, however including 'panic = "unwind"' in Cargo.toml '[profile.bench]' fixes the issue. This causes cargo to warn about the setting being ignored, when it's clearly doing something.
Cargo is not expecting the panic setting to be overridden via RUSTFLAGS. Generally, any rustc flag that cargo needs to control (such as all of those in the profile) should not be specified in RUSTFLAGS.
cargo bench without 'panic = "unwind"' in Cargo.toml '[profile.bench]'
error: the `#[alloc_error_handler]`in std conflicts with allocation error handler in: std
error: the crate `panic_unwind` does not have the panic strategy `unwind`
error[E0152]: duplicate lang item in crate `std` (which `test` depends on): `panic_impl`.
cargo bench with 'panic = "unwind"' in Cargo.toml '[profile.bench]'
warning: /project/Cargo.toml: `panic` setting is ignored for`bench` profile
Finished `bench` profile [optimized] target(s) in 0.10s
Issue still occurs when I remove "-C", "panic=abort", from RUSTFLAGS.
'panic = "unwind"' in Cargo.toml '[profile.bench]' is not being ignored because if I set it to abort I get the same error as before. If changing the value changes the behaviour, how is it ignored?
edit: If I don't have any RUSTFLAGS in ~/.cargo/config.toml I get the same error/warning
Problem
cargo bench fails to compile when using build-std, however including 'panic = "unwind"' in Cargo.toml '[profile.bench]' fixes the issue. This causes cargo to warn about the setting being ignored, when it's clearly doing something.
Steps
versions:
~/.cargo/config.toml
/project/Cargo.toml
bench.rs
cargo bench without 'panic = "unwind"' in Cargo.toml '[profile.bench]'
cargo bench with 'panic = "unwind"' in Cargo.toml '[profile.bench]'
Possible Solution(s)
suppress / remove the warning,
panic
setting is ignored forbench
profileNotes
No response
Version
No response
The text was updated successfully, but these errors were encountered: