-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
-Clink-dead-code causes extern crate failure_derive
to not be found on Windows
#90056
Comments
Hm, that's strange! As a workaround, you can use the The underlying error is: |
I took a closer look. For some reason, the linker is expanding the |
How should the |
No, just |
Not sure whether this is related, but I just tried to test one of my projects with Coverage on Windows 10 x86_64 resulting in this error message:
On my Linux machine, however, the test runs fine. |
…leywiser Make compressed rmeta contain compressed data length after header Fixes rust-lang#90056, which is caused by link.exe introducing padding to the `.rustc` section, since it assumes this will have no effect besides allowing it to possibly use the extra space in future links.
For context, this issue comes up when trying to collect code coverage metrics for projects that depend on certain crates. It was previously reported about a year ago here intellij-rust/intellij-rust#6325 and here mozilla/grcov#502, but the root issue is in
rustc
. What follows is a minimal reproduction.For some reason a crate that depends on
failure
fails to compile when-Clink-dead-code
is set, but only on Windows. It works fine whenRUSTFLAGS
is empty, or on Linux.To reproduce, run the following commands in Powershell on Windows, in an empty folder:
The error printed is:
Running
cargo clean
followed bycargo build -vv
has this output: https://gist.githubusercontent.com/KarelPeeters/e5436e18e618dc23a55b9e77ed3c9279/raw/1f4bc3bc76a8e4e52175138a01ee51a1046c4387/gistfile1.txtThis doesn't happen for most crates, I have about 20 dependencies and this issue only comes up with
failure
/failure_derive
for me. In the first issue someone else had the same problem withconst_fn = "0.4.2"
, but I cannot reproduce that.I tried my own issue on today's stable
rustc 1.55.0 (c8dfcfe04 2021-09-06)
and nightlyrustc 1.58.0-nightly (bd41e09da 2021-10-18)
and both Windows and Linux, and this happens for both versions on Windows and for neither version on Linux.The text was updated successfully, but these errors were encountered: