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

FYI: proptest breaks the compiler with RUSTFLAGS="-C link-dead-code" #124

Closed
boustrophedon opened this issue Jan 25, 2019 · 4 comments
Closed
Labels
partial-fix Workaround available, or issue partially addressed

Comments

@boustrophedon
Copy link

This isn't a problem that proptest can fix (probably), but building proptest with RUSTFLAGS="-C link-dead-code" leads to an ICE. The link-dead-code flag is important for accurate code coverage results.

See rust-lang/rust#52478

@AltSysrq
Copy link
Collaborator

AltSysrq commented Feb 4, 2019

Actually, the diff to work around this turns out to be fairly small:

$ git diff
diff --git a/proptest/src/arbitrary/_alloc/char.rs b/proptest/src/arbitrary/_alloc/char.rs
index 02fd213..04accca 100644
--- a/proptest/src/arbitrary/_alloc/char.rs
+++ b/proptest/src/arbitrary/_alloc/char.rs
@@ -43,11 +43,6 @@ impl_wrap_char!(ToLowercase, char::to_lowercase);
 #[cfg(feature = "unstable")]
 impl_wrap_char!(ToUppercase, char::to_uppercase);
 
-arbitrary!(DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>,
-    SMapped<Vec<u16>, Self>;
-    static_map(vec(any::<u16>(), ..VEC_MAX), decode_utf16)
-);
-
 arbitrary!(ParseCharError, IndFlatten<Mapped<bool, Just<Self>>>;
     any::<bool>().prop_ind_flat_map(|is_two|
         Just((if is_two { "__" } else { "" }).parse::<char>().unwrap_err()))

I will see about putting that behind a feature in the next release.

@AltSysrq
Copy link
Collaborator

AltSysrq commented Feb 11, 2019

0.9.1 now has a workaround. You need to opt out of the break-dead-code feature. If you're currently using the default feature set, you can do that with the following block in Cargo.toml:

[dev-dependencies.proptest]
version = "0.9" # Only works for 0.9.1 or newer
default-features = false
# Enable all default features not known to break code coverage builds
features = ["default-code-coverage"]

I'm going to keep this issue open for now to help direct people to the workaround.

@AltSysrq AltSysrq added the partial-fix Workaround available, or issue partially addressed label Feb 11, 2019
@CAD97
Copy link

CAD97 commented Feb 14, 2020

This has supposedly been fixed in rust-lang/rust#58375, so if local testing shows the bug is fixed, this issue can be closed.

@boustrophedon
Copy link
Author

I can confirm that running RUSTFLAGS="-C link-dead-code" cargo +1.37.0 build fails and that it succeeds with all versions after 1.37. So this has actually been fixed since August :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
partial-fix Workaround available, or issue partially addressed
Projects
None yet
Development

No branches or pull requests

4 participants