Skip to content

Commit 3a89daa

Browse files
bors[bot]cuviper
andauthored
Merge #89
89: Update to rand 0.8 and release 0.4.0 r=cuviper a=cuviper Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents ce0637b + fc629e6 commit 3a89daa

File tree

9 files changed

+50
-11
lines changed

9 files changed

+50
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
rust: [
1616
1.31.0, # 2018!
17-
1.32.0, # rand
17+
1.36.0, # rand
1818
stable,
1919
beta,
2020
nightly

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ categories = ["algorithms", "data-structures", "science", "no-std"]
88
license = "MIT OR Apache-2.0"
99
name = "num-complex"
1010
repository = "https://github.com/rust-num/num-complex"
11-
version = "0.3.1"
11+
version = "0.4.0"
1212
readme = "README.md"
1313
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
1414
edition = "2018"
@@ -30,7 +30,7 @@ default-features = false
3030

3131
[dependencies.rand]
3232
optional = true
33-
version = "0.7"
33+
version = "0.8"
3434
default-features = false
3535

3636
[features]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Add this to your `Cargo.toml`:
1313

1414
```toml
1515
[dependencies]
16-
num-complex = "0.3"
16+
num-complex = "0.4"
1717
```
1818

1919
## Features
@@ -23,7 +23,7 @@ the default `std` feature. Use this in `Cargo.toml`:
2323

2424
```toml
2525
[dependencies.num-complex]
26-
version = "0.3"
26+
version = "0.4"
2727
default-features = false
2828
```
2929

RELEASES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Release 0.4.0 (2021-03-05)
2+
3+
- `rand` support has been updated to 0.8, requiring Rust 1.36.
4+
5+
**Contributors**: @cuviper
6+
17
# Release 0.3.1 (2020-10-29)
28

39
- Clarify the license specification as "MIT OR Apache-2.0".

bors.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
status = [
22
"Test (1.31.0)",
3-
"Test (1.32.0)",
3+
"Test (1.36.0)",
44
"Test (stable)",
55
"Test (beta)",
66
"Test (nightly)",

ci/rustup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
set -ex
66

77
ci=$(dirname $0)
8-
for version in 1.31.0 1.32.0 stable beta nightly; do
8+
for version in 1.31.0 1.36.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

ci/test_full.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if ! check_version $MSRV ; then
2828
fi
2929

3030
FEATURES=(libm serde)
31-
check_version 1.32 && FEATURES+=(rand)
31+
check_version 1.36 && FEATURES+=(rand)
3232
echo "Testing supported features: ${FEATURES[*]}"
3333

3434
set -x

src/crand.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,41 @@ where
4242
}
4343

4444
#[cfg(test)]
45-
fn test_rng() -> StdRng {
46-
StdRng::from_seed([42; 32])
45+
fn test_rng() -> impl RngCore {
46+
/// Simple `Rng` for testing without additional dependencies
47+
struct XorShiftStar {
48+
a: u64,
49+
}
50+
51+
impl RngCore for XorShiftStar {
52+
fn next_u32(&mut self) -> u32 {
53+
self.next_u64() as u32
54+
}
55+
56+
fn next_u64(&mut self) -> u64 {
57+
// https://en.wikipedia.org/wiki/Xorshift#xorshift*
58+
self.a ^= self.a >> 12;
59+
self.a ^= self.a << 25;
60+
self.a ^= self.a >> 27;
61+
self.a.wrapping_mul(0x2545_F491_4F6C_DD1D)
62+
}
63+
64+
fn fill_bytes(&mut self, dest: &mut [u8]) {
65+
for chunk in dest.chunks_mut(8) {
66+
let bytes = self.next_u64().to_le_bytes();
67+
let slice = &bytes[..chunk.len()];
68+
chunk.copy_from_slice(slice)
69+
}
70+
}
71+
72+
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
73+
Ok(self.fill_bytes(dest))
74+
}
75+
}
76+
77+
XorShiftStar {
78+
a: 0x0123_4567_89AB_CDEF,
79+
}
4780
}
4881

4982
#[test]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//!
1515
//! The `num-complex` crate is tested for rustc 1.31 and greater.
1616
17-
#![doc(html_root_url = "https://docs.rs/num-complex/0.3")]
17+
#![doc(html_root_url = "https://docs.rs/num-complex/0.4")]
1818
#![no_std]
1919

2020
#[cfg(any(test, feature = "std"))]

0 commit comments

Comments
 (0)