Skip to content

Commit 2b0cbed

Browse files
committed
Update minimum Rustc version to 1.26.
This is to allow use of "impl Trait".
1 parent c037101 commit 2b0cbed

File tree

9 files changed

+12
-41
lines changed

9 files changed

+12
-41
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sudo: false
88
# - x86_64, ARMv7, a Big-Endian arch (MIPS)
99
matrix:
1010
include:
11-
- rust: 1.22.0
11+
- rust: 1.26.0
1212
install:
1313
script:
1414
- cargo test --tests --no-default-features

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,4 @@ benchmark results in the PR (or to report nothing's changed).
8888
```sh
8989
# Benchmarks (requires nightly)
9090
cargo bench
91-
# Some benchmarks have a faster path with i128_support
92-
cargo bench --features=nightly
9391
```

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ appveyor = { repository = "alexcrichton/rand" }
1919

2020
[features]
2121
default = ["std" ] # without "std" rand uses libcore
22-
nightly = ["i128_support"] # enables all features requiring nightly rust
22+
nightly = [] # enables all features requiring nightly rust
2323
std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-zircon"]
2424
alloc = ["rand_core/alloc"] # enables Vec and Box support (without std)
25-
i128_support = [] # enables i128 and u128 support
25+
i128_support = [] # deprecated; i128 support is now standard
2626
serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs
2727

2828
[workspace]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-lang-nursery/rand?svg=true)](https://ci.appveyor.com/project/alexcrichton/rand)
55
[![Latest version](https://img.shields.io/crates/v/rand.svg)](https://crates.io/crates/rand)
66
[![Documentation](https://docs.rs/rand/badge.svg)](https://docs.rs/rand)
7-
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-yellow.svg)](https://github.com/rust-lang-nursery/rand#rust-version-requirements)
7+
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.26+-yellow.svg)](https://github.com/rust-lang-nursery/rand#rust-version-requirements)
88

99
A Rust library for random number generation.
1010

@@ -96,7 +96,8 @@ For more details, see the [changelog](CHANGELOG.md).
9696

9797
### Rust version requirements
9898

99-
The 0.5 release of Rand requires **Rustc version 1.22 or greater**.
99+
The 0.6 release of Rand requires **Rustc version 1.26 or greater**.
100+
Rand 0.5 requires Rustc version 1.22 or greater.
100101
Rand 0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or
101102
greater. Subsets of the Rand code may work with older Rust versions, but this
102103
is not supported.
@@ -112,9 +113,8 @@ Rand is built with only the `std` feature anabled by default. The following
112113
optional features are available:
113114

114115
- `alloc` can be used instead of `std` to provide `Vec` and `Box`.
115-
- `i128_support` enables support for generating `u128` and `i128` values.
116116
- `log` enables some logging via the `log` crate.
117-
- `nightly` enables all unstable features (`i128_support`).
117+
- `nightly` enables all unstable features (currently none).
118118
- `serde1` enables serialization for some types, via Serde version 1.
119119
- `stdweb` enables support for `OsRng` on WASM via stdweb.
120120

benches/distributions.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#![feature(test)]
2-
#![cfg_attr(all(feature="i128_support", feature="nightly"), allow(stable_features))] // stable since 2018-03-27
3-
#![cfg_attr(all(feature="i128_support", feature="nightly"), feature(i128_type, i128))]
42

53
extern crate test;
64
extern crate rand;
@@ -78,7 +76,6 @@ distr_int!(distr_uniform_i8, i8, Uniform::new(20i8, 100));
7876
distr_int!(distr_uniform_i16, i16, Uniform::new(-500i16, 2000));
7977
distr_int!(distr_uniform_i32, i32, Uniform::new(-200_000_000i32, 800_000_000));
8078
distr_int!(distr_uniform_i64, i64, Uniform::new(3i64, 123_456_789_123));
81-
#[cfg(feature = "i128_support")]
8279
distr_int!(distr_uniform_i128, i128, Uniform::new(-123_456_789_123i128, 123_456_789_123_456_789));
8380

8481
distr_float!(distr_uniform_f32, f32, Uniform::new(2.26f32, 2.319));
@@ -89,7 +86,6 @@ distr_int!(distr_standard_i8, i8, Standard);
8986
distr_int!(distr_standard_i16, i16, Standard);
9087
distr_int!(distr_standard_i32, i32, Standard);
9188
distr_int!(distr_standard_i64, i64, Standard);
92-
#[cfg(feature = "i128_support")]
9389
distr_int!(distr_standard_i128, i128, Standard);
9490

9591
distr!(distr_standard_bool, bool, Standard);
@@ -140,7 +136,6 @@ gen_range_int!(gen_range_i8, i8, -20i8, 100);
140136
gen_range_int!(gen_range_i16, i16, -500i16, 2000);
141137
gen_range_int!(gen_range_i32, i32, -200_000_000i32, 800_000_000);
142138
gen_range_int!(gen_range_i64, i64, 3i64, 123_456_789_123);
143-
#[cfg(feature = "i128_support")]
144139
gen_range_int!(gen_range_i128, i128, -12345678901234i128, 123_456_789_123_456_789);
145140

146141
#[bench]

src/distributions/integer.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ impl Distribution<u64> for Standard {
4141
}
4242
}
4343

44-
#[cfg(feature = "i128_support")]
4544
impl Distribution<u128> for Standard {
4645
#[inline]
4746
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> u128 {
@@ -81,7 +80,7 @@ impl_int_from_uint! { i8, u8 }
8180
impl_int_from_uint! { i16, u16 }
8281
impl_int_from_uint! { i32, u32 }
8382
impl_int_from_uint! { i64, u64 }
84-
#[cfg(feature = "i128_support")] impl_int_from_uint! { i128, u128 }
83+
impl_int_from_uint! { i128, u128 }
8584
impl_int_from_uint! { isize, usize }
8685

8786

@@ -99,15 +98,13 @@ mod tests {
9998
rng.sample::<i16, _>(Standard);
10099
rng.sample::<i32, _>(Standard);
101100
rng.sample::<i64, _>(Standard);
102-
#[cfg(feature = "i128_support")]
103101
rng.sample::<i128, _>(Standard);
104102

105103
rng.sample::<usize, _>(Standard);
106104
rng.sample::<u8, _>(Standard);
107105
rng.sample::<u16, _>(Standard);
108106
rng.sample::<u32, _>(Standard);
109107
rng.sample::<u64, _>(Standard);
110-
#[cfg(feature = "i128_support")]
111108
rng.sample::<u128, _>(Standard);
112109
}
113110
}

src/distributions/uniform.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,13 @@ uniform_int_impl! { i8, i8, u8, i32, u32 }
398398
uniform_int_impl! { i16, i16, u16, i32, u32 }
399399
uniform_int_impl! { i32, i32, u32, i32, u32 }
400400
uniform_int_impl! { i64, i64, u64, i64, u64 }
401-
#[cfg(feature = "i128_support")]
402401
uniform_int_impl! { i128, i128, u128, u128, u128 }
403402
uniform_int_impl! { isize, isize, usize, isize, usize }
404403
uniform_int_impl! { u8, i8, u8, i32, u32 }
405404
uniform_int_impl! { u16, i16, u16, i32, u32 }
406405
uniform_int_impl! { u32, i32, u32, i32, u32 }
407406
uniform_int_impl! { u64, i64, u64, i64, u64 }
408407
uniform_int_impl! { usize, isize, usize, isize, usize }
409-
#[cfg(feature = "i128_support")]
410408
uniform_int_impl! { u128, u128, u128, i128, u128 }
411409

412410

@@ -432,7 +430,6 @@ macro_rules! wmul_impl {
432430
wmul_impl! { u8, u16, 8 }
433431
wmul_impl! { u16, u32, 16 }
434432
wmul_impl! { u32, u64, 32 }
435-
#[cfg(feature = "i128_support")]
436433
wmul_impl! { u64, u128, 64 }
437434

438435
// This code is a translation of the __mulddi3 function in LLVM's
@@ -467,9 +464,6 @@ macro_rules! wmul_impl_large {
467464
}
468465
}
469466
}
470-
#[cfg(not(feature = "i128_support"))]
471-
wmul_impl_large! { u64, 32 }
472-
#[cfg(feature = "i128_support")]
473467
wmul_impl_large! { u128, 64 }
474468

475469
macro_rules! wmul_impl_usize {
@@ -758,10 +752,8 @@ mod tests {
758752
)*
759753
}}
760754
}
761-
t!(i8, i16, i32, i64, isize,
762-
u8, u16, u32, u64, usize);
763-
#[cfg(feature = "i128_support")]
764-
t!(i128, u128)
755+
t!(i8, i16, i32, i64, i128, isize,
756+
u8, u16, u32, u64, u128, usize);
765757
}
766758

767759
#[test]

src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@
231231

232232
#![cfg_attr(not(feature="std"), no_std)]
233233
#![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))]
234-
#![cfg_attr(all(feature="i128_support", feature="nightly"), allow(stable_features))] // stable since 2018-03-27
235-
#![cfg_attr(all(feature="i128_support", feature="nightly"), feature(i128_type, i128))]
236234
#![cfg_attr(feature = "stdweb", recursion_limit="128")]
237235

238236
#[cfg(feature="std")] extern crate std as core;
@@ -696,13 +694,13 @@ macro_rules! impl_as_byte_slice {
696694
impl_as_byte_slice!(u16);
697695
impl_as_byte_slice!(u32);
698696
impl_as_byte_slice!(u64);
699-
#[cfg(feature="i128_support")] impl_as_byte_slice!(u128);
697+
impl_as_byte_slice!(u128);
700698
impl_as_byte_slice!(usize);
701699
impl_as_byte_slice!(i8);
702700
impl_as_byte_slice!(i16);
703701
impl_as_byte_slice!(i32);
704702
impl_as_byte_slice!(i64);
705-
#[cfg(feature="i128_support")] impl_as_byte_slice!(i128);
703+
impl_as_byte_slice!(i128);
706704
impl_as_byte_slice!(isize);
707705

708706
macro_rules! impl_as_byte_slice_arrays {

src/prng/chacha.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ impl ChaChaRng {
138138
/// counter is 64-bits, the offset is a 68-bit number. Sub-word offsets are
139139
/// not supported, hence the result can simply be multiplied by 4 to get a
140140
/// byte-offset.
141-
///
142-
/// Note: this function is currently only available when the `i128_support`
143-
/// feature is enabled. In the future this will be enabled by default.
144-
#[cfg(feature = "i128_support")]
145141
pub fn get_word_pos(&self) -> u128 {
146142
let mut c = (self.0.core.state[13] as u64) << 32
147143
| (self.0.core.state[12] as u64);
@@ -160,10 +156,6 @@ impl ChaChaRng {
160156
/// As with `get_word_pos`, we use a 68-bit number. Since the generator
161157
/// simply cycles at the end of its period (1 ZiB), we ignore the upper
162158
/// 60 bits.
163-
///
164-
/// Note: this function is currently only available when the `i128_support`
165-
/// feature is enabled. In the future this will be enabled by default.
166-
#[cfg(feature = "i128_support")]
167159
pub fn set_word_pos(&mut self, word_offset: u128) {
168160
let index = (word_offset as usize) & 0xF;
169161
let counter = (word_offset >> 4) as u64;
@@ -358,7 +350,6 @@ mod test {
358350
}
359351

360352
#[test]
361-
#[cfg(feature = "i128_support")]
362353
fn test_chacha_true_values_c() {
363354
// Test vector 4 from
364355
// https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04

0 commit comments

Comments
 (0)