Skip to content

Commit 8fc5640

Browse files
committed
Add workaround for rust-lang/rust#52478.
1 parent 2325e7a commit 8fc5640

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ script:
1717
- |
1818
(cd proptest && travis-cargo build) &&
1919
(cd proptest && travis-cargo test) &&
20+
(cd proptest && env RUST_FLAGS='-C link-dead-code' travis-cargo --only stable build -- --no-default-features --features default-code-coverage) &&
2021
(cd proptest && travis-cargo --only stable build -- --no-default-features --features fork) &&
2122
(cd proptest && travis-cargo --only stable build -- --lib --no-default-features --features std) &&
2223
(cd proptest && travis-cargo --only nightly build -- --no-default-features --features "alloc unstable") &&

proptest/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ makes it possible to use an external source of entropy with Proptest.
3030
- `TestRunner` now has a `deterministic()` constructor which uses the same RNG
3131
every time, to facilitate doing statistical tests on strategy outputs.
3232

33+
- There is now a work-around for a [compiler
34+
bug](https://github.com/rust-lang/rust/issues/52478) which prevents building
35+
with `-C link-dead-code`. Please see this issue for details:
36+
https://github.com/AltSysrq/proptest/issues/124
37+
3338
### Deprecations
3439

3540
- The `load_persisted_failures` and `save_persisted_failure` methods on the

proptest/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ service = "github"
2525

2626
[features]
2727

28-
default = ["std", "fork", "timeout", "bit-set"]
28+
default = ["std", "fork", "timeout", "bit-set", "break-dead-code"]
29+
# Everything in `default` that doesn't break code coverage builds
30+
default-code-coverage = ["std", "fork", "timeout", "bit-set"]
2931

3032
# Enables unstable features of Rust.
3133
unstable = []
@@ -53,6 +55,10 @@ timeout = ["fork", "rusty-fork/timeout"]
5355
# need it excluded, however.
5456
atomic64bit = []
5557

58+
# Include features which break the Rust compiler when `-C link-dead-code` is
59+
# passed (see https://github.com/AltSysrq/proptest/issues/124).
60+
break-dead-code = []
61+
5662
[dependencies]
5763
bitflags = "1.0.1"
5864

proptest/src/arbitrary/_alloc/char.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ impl_wrap_char!(ToLowercase, char::to_lowercase);
4343
#[cfg(feature = "unstable")]
4444
impl_wrap_char!(ToUppercase, char::to_uppercase);
4545

46+
#[cfg(feature = "break-dead-code")]
4647
arbitrary!(DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>,
4748
SMapped<Vec<u16>, Self>;
4849
static_map(vec(any::<u16>(), ..VEC_MAX), decode_utf16)
@@ -71,10 +72,14 @@ mod test {
7172
escape_default => EscapeDefault,
7273
escape_unicode => EscapeUnicode,
7374
parse_char_error => ParseCharError,
74-
decode_utf16 => DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>,
7575
decode_utf16_error => DecodeUtf16Error
7676
);
7777

78+
#[cfg(feature = "break-dead-code")]
79+
no_panic_test!(
80+
decode_utf16 => DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>
81+
);
82+
7883
#[cfg(feature = "unstable")]
7984
no_panic_test!(
8085
to_lowercase => ToLowercase,

0 commit comments

Comments
 (0)