Skip to content

Commit 80e945f

Browse files
committed
Automatically enable inclusive range support
This gets rid of the `rust_1_27` cargo feature.
1 parent f499d08 commit 80e945f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Random number generators and other randomness functionality.
1212
"""
1313
keywords = ["random", "rng"]
1414
categories = ["algorithms", "no-std"]
15+
build = "build.rs"
1516

1617
[badges]
1718
travis-ci = { repository = "rust-lang-nursery/rand" }
@@ -25,7 +26,6 @@ alloc = ["rand_core/alloc"] # enables Vec and Box support (without std)
2526
i128_support = [] # enables i128 and u128 support
2627
simd_support = [] # enables SIMD support
2728
serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs
28-
rust_1_27 = ["i128_support"] # enables RangeInclusive, i128 and u128 support for Rust >= 1.27
2929

3030
[workspace]
3131
members = ["rand_core", "rand_isaac"]
@@ -60,5 +60,8 @@ wasm-bindgen = { version = "0.2.12", optional = true }
6060
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
6161
bincode = "1.0"
6262

63+
[build-dependencies]
64+
rustc_version = "0.2"
65+
6366
[package.metadata.docs.rs]
6467
all-features = true

src/distributions/uniform.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl<X: SampleUniform> From<::core::ops::Range<X>> for Uniform<X> {
276276
}
277277
}
278278

279-
#[cfg(feature = "rust_1_27")]
279+
#[cfg(rust_1_27)]
280280
impl<X: SampleUniform> From<::core::ops::RangeInclusive<X>> for Uniform<X> {
281281
fn from(r: ::core::ops::RangeInclusive<X>) -> Uniform<X> {
282282
Uniform::new_inclusive(r.start(), r.end())
@@ -1068,7 +1068,7 @@ mod tests {
10681068
assert_eq!(r.inner.scale, 5.0);
10691069
}
10701070

1071-
#[cfg(feature = "rust_1_27")]
1071+
#[cfg(rust_1_27)]
10721072
#[test]
10731073
fn test_uniform_from_std_range_inclusive() {
10741074
let r = Uniform::from(2u32..=6);

0 commit comments

Comments
 (0)