-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed as not planned
Closed as not planned
Copy link
Labels
A-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.
Description
Code
[profile.release]
panic = "abort"
rustup run nightly-2023-09-17 cargo rustc -p dune --profile release -Z build-std=std,core --target x86_64-pc-windows-msvc
The nightly version is not important, it's only what I was testing on.
Current output
A bunch of these:
error[E0152]: duplicate lang item in crate `core`: `sized`.
|
= note: the lang item is first defined in crate `core` (which `std` depends on)
= note: first definition in `core` loaded from \\?\D:\repos\dune\target\x86_64-pc-windows-msvc\release\deps\libcore-8e933d06c178c4de.rlib, \\?\D:\repos\dune\target\x86_64-pc-windows-msvc\release\deps\libcore-8e933d06c178c4de.rmeta
= note: second definition in `core` loaded from \\?\C:\Users\tachyon\.rustup\toolchains\nightly-2023-08-17-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-b86a9ba077d96bbb.rlib
Desired output
A nice message that said panic_abort
must be included in build-std
if compiled with panic = "abort"
.
Rationale and extra context
From @Nilstrieb:
rustc can't find a panic_abort
in your self-built standard library, so it falls back to loading panic_abort
from the sysroot. But that sysroot panic_abort
then also brings in the rest of the sysroot, including core
, so now you have two cores, one from your target dir and one from your sysroot. This is bad.
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.