Skip to content

Commit 19169cb

Browse files
authored
Bump MSRV to 1.56 (Edition 2021) (#1269)
* Bump MSRV to 1.56 (Edition 2021) * Apply Clippy suggestions * Bump edition and add rust-version field to Cargo.toml * CI AVR test: unpin nightly rust version * Disable AVR test * Bump crate version numbers for a breaking release
1 parent 7aa25d5 commit 19169cb

File tree

18 files changed

+55
-48
lines changed

18 files changed

+55
-48
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
# Test both windows-gnu and windows-msvc; use beta rust on one
4444
- os: ubuntu-latest
4545
target: x86_64-unknown-linux-gnu
46-
toolchain: 1.51.0 # MSRV
46+
toolchain: 1.56.0 # MSRV
4747
- os: ubuntu-latest
4848
deps: sudo apt-get update ; sudo apt install gcc-multilib
4949
target: i686-unknown-linux-gnu
@@ -161,17 +161,17 @@ jobs:
161161
- name: Build top-level only
162162
run: cargo build --target=thumbv6m-none-eabi --no-default-features
163163

164-
test-avr:
165-
runs-on: ubuntu-latest
166-
steps:
167-
- uses: actions/checkout@v3
168-
- name: Install toolchain
169-
uses: dtolnay/rust-toolchain@master
170-
with:
171-
toolchain: nightly-2021-01-07 # Pinned compiler version due to https://github.com/rust-lang/compiler-builtins/issues/400
172-
components: rust-src
173-
- name: Build top-level only
174-
run: cargo build -Z build-std=core --target=avr-unknown-gnu-atmega328 --no-default-features
164+
# Disabled due to lack of known working compiler versions (not older than our MSRV)
165+
# test-avr:
166+
# runs-on: ubuntu-latest
167+
# steps:
168+
# - uses: actions/checkout@v3
169+
# - name: Install toolchain
170+
# uses: dtolnay/rust-toolchain@nightly
171+
# with:
172+
# components: rust-src
173+
# - name: Build top-level only
174+
# run: cargo build -Z build-std=core --target=avr-unknown-gnu-atmega328 --no-default-features
175175

176176
test-ios:
177177
runs-on: macos-latest

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand"
3-
version = "0.8.5"
3+
version = "0.9.0"
44
authors = ["The Rand Project Developers", "The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -13,7 +13,8 @@ Random number generators and other randomness functionality.
1313
keywords = ["random", "rng"]
1414
categories = ["algorithms", "no-std"]
1515
autobenches = true
16-
edition = "2018"
16+
edition = "2021"
17+
rust-version = "1.56"
1718
include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"]
1819

1920
[package.metadata.docs.rs]
@@ -59,17 +60,17 @@ members = [
5960
]
6061

6162
[dependencies]
62-
rand_core = { path = "rand_core", version = "0.6.0" }
63+
rand_core = { path = "rand_core", version = "0.7.0" }
6364
log = { version = "0.4.4", optional = true }
6465
serde = { version = "1.0.103", features = ["derive"], optional = true }
65-
rand_chacha = { path = "rand_chacha", version = "0.3.0", default-features = false, optional = true }
66+
rand_chacha = { path = "rand_chacha", version = "0.4.0", default-features = false, optional = true }
6667

6768
[target.'cfg(unix)'.dependencies]
6869
# Used for fork protection (reseeding.rs)
6970
libc = { version = "0.2.22", optional = true, default-features = false }
7071

7172
[dev-dependencies]
72-
rand_pcg = { path = "rand_pcg", version = "0.3.0" }
73+
rand_pcg = { path = "rand_pcg", version = "0.4.0" }
7374
# Only to test serde1
7475
bincode = "1.2.1"
7576
rayon = "1.5.3"

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
66
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand)
77
[![API](https://docs.rs/rand/badge.svg)](https://docs.rs/rand)
8-
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.51+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
8+
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.56+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
99

1010
A Rust library for random number generation, featuring:
1111

@@ -95,9 +95,10 @@ Some versions of Rand crates have been yanked ("unreleased"). Where this occurs,
9595
the crate's CHANGELOG *should* be updated with a rationale, and a search on the
9696
issue tracker with the keyword `yank` *should* uncover the motivation.
9797

98-
### Rust version requirements (MSRV)
98+
### Rust version requirements
9999

100-
This version of Rand requires Rustc >= 1.51.0.
100+
The Minimum Supported Rust Version (MSRV) is `rustc >= 1.56.0`.
101+
Older releases may work (depending on feature configuration) but are untested.
101102

102103
## Crate Features
103104

rand_chacha/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_chacha"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = ["The Rand Project Developers", "The Rust Project Developers", "The CryptoCorrosion Contributors"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -12,10 +12,11 @@ ChaCha random number generator
1212
"""
1313
keywords = ["random", "rng", "chacha"]
1414
categories = ["algorithms", "no-std"]
15-
edition = "2018"
15+
edition = "2021"
16+
rust-version = "1.56"
1617

1718
[dependencies]
18-
rand_core = { path = "../rand_core", version = "0.6.0" }
19+
rand_core = { path = "../rand_core", version = "0.7.0" }
1920
ppv-lite86 = { version = "0.2.14", default-features = false, features = ["simd"] }
2021
serde = { version = "1.0", features = ["derive"], optional = true }
2122

rand_chacha/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
66
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_chacha)
77
[![API](https://docs.rs/rand_chacha/badge.svg)](https://docs.rs/rand_chacha)
8-
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.51+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
8+
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.56+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
99

1010
A cryptographically secure random number generator that uses the ChaCha
1111
algorithm.

rand_core/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_core"
3-
version = "0.6.4"
3+
version = "0.7.0"
44
authors = ["The Rand Project Developers", "The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -12,7 +12,8 @@ Core random number generator traits and tools for implementation.
1212
"""
1313
keywords = ["random", "rng"]
1414
categories = ["algorithms", "no-std"]
15-
edition = "2018"
15+
edition = "2021"
16+
rust-version = "1.56"
1617

1718
[package.metadata.docs.rs]
1819
# To build locally:

rand_core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
66
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_core)
77
[![API](https://docs.rs/rand_core/badge.svg)](https://docs.rs/rand_core)
8-
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.51+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
8+
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.56+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
99

1010
Core traits and error types of the [rand] library, plus tools for implementing
1111
RNGs.

rand_core/src/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,13 @@ impl<R: BlockRngCore<Item = u64>> RngCore for BlockRng64<R> {
381381
let mut read_len = 0;
382382
self.half_used = false;
383383
while read_len < dest.len() {
384-
if self.index as usize >= self.results.as_ref().len() {
384+
if self.index >= self.results.as_ref().len() {
385385
self.core.generate(&mut self.results);
386386
self.index = 0;
387387
}
388388

389389
let (consumed_u64, filled_u8) = fill_via_u64_chunks(
390-
&self.results.as_ref()[self.index as usize..],
390+
&self.results.as_ref()[self.index..],
391391
&mut dest[read_len..],
392392
);
393393

rand_distr/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_distr"
3-
version = "0.4.3"
3+
version = "0.5.0"
44
authors = ["The Rand Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -12,7 +12,8 @@ Sampling from random number distributions
1212
"""
1313
keywords = ["random", "rng", "distribution", "probability"]
1414
categories = ["algorithms", "no-std"]
15-
edition = "2018"
15+
edition = "2021"
16+
rust-version = "1.56"
1617
include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"]
1718

1819
[features]
@@ -23,14 +24,14 @@ std_math = ["num-traits/std"]
2324
serde1 = ["serde", "rand/serde1"]
2425

2526
[dependencies]
26-
rand = { path = "..", version = "0.8.0", default-features = false }
27+
rand = { path = "..", version = "0.9.0", default-features = false }
2728
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
2829
serde = { version = "1.0.103", features = ["derive"], optional = true }
2930

3031
[dev-dependencies]
31-
rand_pcg = { version = "0.3.0", path = "../rand_pcg" }
32+
rand_pcg = { version = "0.4.0", path = "../rand_pcg" }
3233
# For inline examples
33-
rand = { path = "..", version = "0.8.0", default-features = false, features = ["std_rng", "std", "small_rng"] }
34+
rand = { path = "..", version = "0.9.0", default-features = false, features = ["std_rng", "std", "small_rng"] }
3435
# Histogram implementation for testing uniformity
3536
average = { version = "0.13", features = [ "std" ] }
3637
# Special functions for testing distributions

rand_distr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
66
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_distr)
77
[![API](https://docs.rs/rand_distr/badge.svg)](https://docs.rs/rand_distr)
8-
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.51+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
8+
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.56+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
99

1010
Implements a full suite of random number distribution sampling routines.
1111

0 commit comments

Comments
 (0)