I know that this is definitely a Rust compiler error but I just wanted to make you aware of this fact. It's a problem that apparently also hits cargo-kcov but it didn't test that. The issue is tracked here: https://github.com/rust-lang/rust/issues/52478
Perhaps if you have any idea what's going on you can help track it down in rustc, that'd be nice. :)
Thanks for letting me know :+1:
I found a workaround that allows using tarpaulin with proptest even with this compiler bug present. It uses a small wrapper script which removes the -C link-dead-code flag just for the proptest crate. When that script is executable and in $PATH, running RUSTC=rustc-proptest-fix cargo tarpaulin just works.
This is not very elegant, but property based testing + coverage is just too useful to wait for the ICE to get fixed :)
Thanks for the script! Wouldn't that be a good thing to include in tarpaulin for the time being? Maybe this could be put directly into the tool to workaround this problem. What do you think @xd009642?
I'm not sure about including it in tarpaulin, removing link-dead-code means that unused functions may be completely removed from the coverage stats. Depending on how aggressive it is (I haven't checked), it might render the coverage results largely useless. Whereas this issue should be easy to find and a workaround is clear in the comments.
However, there is another issue caused by link-dead-code so I'll have to mull this over some.
My script does not remove -C link-dead-code in general. It is only removed for the proptest dependency, i.e. it would only be an issue if you would be testing proptest itself, rather than using proptest to write tests for your own code, which is still compiled with -C link-dead-code.
I'm not sure if mixing crates with different RUSTFLAGS like this is supported (my guess would be no), but it has been working fine for me so far.
At least within a crate dead code elimination is very aggressive, so -C link-dead-code is certainly needed for the crate under test.
This issue seems to have been solved as of rustc 1.38.0-nightly (dddb7fca0 2019-07-30) at least.
Awesome, I'll keep this issue open until it makes it into stable then close it
Most helpful comment
I found a workaround that allows using tarpaulin with proptest even with this compiler bug present. It uses a small wrapper script which removes the
-C link-dead-codeflag just for the proptest crate. When that script is executable and in$PATH, runningRUSTC=rustc-proptest-fix cargo tarpaulinjust works.This is not very elegant, but property based testing + coverage is just too useful to wait for the ICE to get fixed :)