Skip to content

Commit

Permalink
[fix-ci-nigtly] ci was broken on nightly the series of fixes should c…
Browse files Browse the repository at this point in the history
…orrect it

* dependencies.x86 was bumped to latest current version. x86 crate
  does not advertise an MSRV, but this was just broken on even our
  MSRV because the old x86 version was using a macro removed from
  rust, so bumping to latest seems fair.
* the calculation for the arbitrary impl of Layout was using a
  max_size that was too large and overflowing Layout. this has
  been fixed.
* test for arbitrary AllocError was referring to AllocErr which
  does not exist, this was fixed.
* NoneError has been removed from rust so it was subsequently
  removed from proptest. It was blocking compilation.
  evidence:
  rust-lang/rust#85614
* try_reserve is stable so removed from unstable features
* try_trait has been changed to try_trait_v2 so that was fixed
  in Cargo.toml.
  • Loading branch information
rex-remind101 committed Dec 19, 2022
1 parent a077ade commit 6a958db
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
14 changes: 13 additions & 1 deletion proptest/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

- Sampling from large ranges of floats such as `(0f32)..` no longer panics
with newer versions of the `rand` crate
- [dependencies.x86] was bumped to latest current version. x86 crate does
was on a very old version 0.33.0 which used a removed macro from rust.
- The calculation for the arbitrary impl of Layout was using a max_size that
was too large and overflowing Layout. This has been fixed.
- Test for arbitrary AllocError was referring to AllocErr which
does not exist, this was fixed.
- NoneError has been removed from rust so it was subsequently
removed from proptest. It was blocking compilation. evidence:
https://github.com/rust-lang/rust/issues/85614
- `try_reserve` is stable so removed from unstable features
- `try_trait` has been changed to `try_trait_v2` so that was adjusted
in `Cargo.toml`.

### New Features

Expand Down Expand Up @@ -641,7 +653,7 @@ features.
These are "higher order" `Arbitrary` traits that correspond to the `Arbitrary1`
and `Arbitrary2` type classes in Haskell's QuickCheck. They are mainly provided
to support a common set of container-like types in custom deriving self-recursive
types in `proptest_derive`. More on this later releases.
types in `proptest_derive`. More on this later releases.

- The strategies in `proptest::option` and `proptest::result` now accept a type
`Probability` which is a wrapper around `f64`. Conversions from types such as
Expand Down
2 changes: 1 addition & 1 deletion proptest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ version = "3.0"
optional = true

[dependencies.x86]
version = "0.33.0"
version = "0.52.0"
optional = true

[dev-dependencies]
Expand Down
6 changes: 4 additions & 2 deletions proptest/src/arbitrary/_alloc/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ arbitrary!(self::alloc::Layout, SFnPtrMap<(Range<u8>, StrategyFor<usize>), Self>
// 2. "when rounded up to the nearest multiple of align, must not overflow".
static_map((0u8..32u8, any::<usize>()), |(align_power, size)| {
let align = 1usize << align_power;
let max_size = 0usize.wrapping_sub(align);
// TODO: This may only work on 64 bit processors, but previously it was broken
// even on 64 bit so still an improvement. 63 -> uint size - 1.
let max_size = (1usize << 63) - (1 << usize::from(align_power));
// Not quite a uniform distribution due to clamping,
// but probably good enough
self::alloc::Layout::from_size_align(cmp::min(max_size, size), align).unwrap()
Expand All @@ -51,7 +53,7 @@ mod test {

no_panic_test!(
layout => self::alloc::Layout,
alloc_err => self::alloc::AllocErr
alloc_err => self::alloc::AllocError
//collection_alloc_err => alloc::collections::CollectionAllocErr
);
}
3 changes: 0 additions & 3 deletions proptest/src/arbitrary/_core/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ lift1!(['static] opt::IntoIter<A>, Probability;
base, prob => weighted(prob, base).prop_map(Option::into_iter)
);

#[cfg(feature = "unstable")]
arbitrary!(opt::NoneError; opt::NoneError);

#[cfg(test)]
mod test {
no_panic_test!(
Expand Down
5 changes: 2 additions & 3 deletions proptest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
feature = "unstable",
feature(
allocator_api,
try_trait,
try_trait_v2,
generator_trait,
never_type,
try_reserve
never_type
)
)]
#![cfg_attr(all(feature = "std", feature = "unstable"), feature(ip))]
Expand Down

0 comments on commit 6a958db

Please sign in to comment.