Skip to content
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

tarpaulin causes ICE if used with proptest #161

Closed
svenstaro opened this issue Nov 14, 2018 · 7 comments
Closed

tarpaulin causes ICE if used with proptest #161

svenstaro opened this issue Nov 14, 2018 · 7 comments

Comments

@svenstaro
Copy link
Contributor

svenstaro commented Nov 14, 2018

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: rust-lang/rust#52478

Perhaps if you have any idea what's going on you can help track it down in rustc, that'd be nice. :)

@xd009642
Copy link
Owner

Thanks for letting me know 👍

@jix
Copy link

jix commented Jan 18, 2019

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 :)

@svenstaro
Copy link
Contributor Author

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?

@xd009642
Copy link
Owner

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.

@jix
Copy link

jix commented Jan 18, 2019

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.

@brunocodutra
Copy link

This issue seems to have been solved as of rustc 1.38.0-nightly (dddb7fca0 2019-07-30) at least.

@xd009642
Copy link
Owner

Awesome, I'll keep this issue open until it makes it into stable then close it

@xd009642 xd009642 closed this as completed Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants