Codebase list rust-stfu8 / c96abc2
Patch proptest to rand 0.7 kpcyrd 4 years ago
7 changed file(s) with 109 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 rust-proptest (0.9.4-2) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Package proptest 0.9.4 from crates.io using debcargo 2.4.0
3
4 -- kpcyrd <git@rxv.cc> Tue, 15 Oct 2019 10:02:55 +0000
5
06 rust-proptest (0.9.4-1) unstable; urgency=medium
17
28 * Team upload.
1414 Copyright:
1515 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
1616 2019 Ximin Luo <infinity0@debian.org>
17 2019 kpcyrd <git@rxv.cc>
1718 License: MIT or Apache-2.0
1819
1920 License: Apache-2.0
680680 Copyright:
681681 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
682682 2019 Ximin Luo <infinity0@debian.org>
683 2019 kpcyrd <git@rxv.cc>
683684 License: MIT or Apache-2.0
684685
685686 License: Apache-2.0
00 overlay = "."
1 uploaders = ["Ximin Luo <infinity0@debian.org>"]
1 uploaders = [
2 "Ximin Luo <infinity0@debian.org>",
3 "kpcyrd <git@rxv.cc>",
4 ]
0 From 3544f3612448a2222f72dbd2c45d3dc5dbe64083 Mon Sep 17 00:00:00 2001
1 From: Jim Turner <git@turner.link>
2 Date: Mon, 14 Oct 2019 17:30:12 -0400
3 Subject: [PATCH] Update to rand 0.7
4
5 ---
6 proptest/CHANGELOG.md | 6 ++++++
7 proptest/Cargo.toml | 8 +++----
8 proptest/src/test_runner/rng.rs | 37 ++++++++++++++++++++++++++++-----
9 3 files changed, 42 insertions(+), 9 deletions(-)
10
11 diff --git a/src/test_runner/rng.rs b/src/test_runner/rng.rs
12 index 7b1dba1..44522af 100644
13 --- a/src/test_runner/rng.rs
14 +++ b/src/test_runner/rng.rs
15 @@ -115,6 +115,37 @@ enum TestRngImpl {
16 },
17 }
18
19 +/// Error indicating that the `PassThrough` RNG ran out of data.
20 +#[derive(Debug, Clone)]
21 +struct PassThroughExhaustedError;
22 +
23 +impl PassThroughExhaustedError {
24 + /// Error code representing this error for `no_std` (instead of boxing the error).
25 + #[allow(unused)]
26 + pub const ERROR_CODE: u32 = rand::Error::CUSTOM_START + 0x35e43220;
27 +}
28 +
29 +impl fmt::Display for PassThroughExhaustedError {
30 + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
31 + write!(f, "out of PassThrough data")
32 + }
33 +}
34 +
35 +#[cfg(feature = "std")]
36 +impl std::error::Error for PassThroughExhaustedError {}
37 +
38 +impl From<PassThroughExhaustedError> for rand::Error {
39 + fn from(err: PassThroughExhaustedError) -> rand::Error {
40 + #[cfg(feature = "std")]
41 + return rand::Error::new(err);
42 + #[cfg(not(feature = "std"))]
43 + return rand::Error::from(
44 + core::num::NonZeroU32::new(PassThroughExhaustedError::ERROR_CODE)
45 + .unwrap(),
46 + );
47 + }
48 +}
49 +
50 impl RngCore for TestRng {
51 fn next_u32(&mut self) -> u32 {
52 match &mut self.rng {
53 @@ -174,10 +205,7 @@ impl RngCore for TestRng {
54 ref data,
55 } => {
56 if *off + dest.len() > end {
57 - return Err(rand::Error::new(
58 - rand::ErrorKind::Unavailable,
59 - "out of PassThrough data",
60 - ));
61 + return Err(rand::Error::from(PassThroughExhaustedError));
62 }
63
64 dest.copy_from_slice(&data[*off..*off + dest.len()]);
65 @@ -345,7 +373,6 @@ impl TestRng {
66 pub(crate) fn default_rng(algorithm: RngAlgorithm) -> Self {
67 #[cfg(feature = "std")]
68 {
69 - use rand::FromEntropy;
70 Self {
71 rng: match algorithm {
72 RngAlgorithm::XorShift => {
0 --- a/Cargo.toml
1 +++ b/Cargo.toml
2 @@ -48,15 +48,15 @@
3 optional = true
4
5 [dependencies.rand]
6 -version = "0.6"
7 -features = ["alloc", "i128_support"]
8 +version = "0.7"
9 +features = ["alloc"]
10 default-features = false
11
12 [dependencies.rand_chacha]
13 -version = "0.1"
14 +version = "0.2"
15
16 [dependencies.rand_xorshift]
17 -version = "0.1"
18 +version = "0.2"
19
20 [dependencies.regex-syntax]
21 version = "0.6.0"
0 relax-deps.patch
1 rand-170.patch