Skip to content

Commit 74c68bf

Browse files
authored
Merge pull request #545 from dhardy/nightly
Fix build errors on nightly (alloc crate changes)
2 parents 0faff20 + 90d306f commit 74c68bf

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ matrix:
1111
- rust: 1.22.0
1212
install:
1313
script:
14-
- cargo test --tests --no-default-features
14+
# TODO: use --tests instead of --lib on more recent compiler
15+
- cargo test --lib --no-default-features
1516
- cargo test --package rand_core --no-default-features
1617
- cargo test --features serde1,log
1718
- rust: stable

src/distributions/float.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ macro_rules! float_impls {
9595
// The exponent is encoded using an offset-binary representation
9696
let exponent_bits: $u_scalar =
9797
(($exponent_bias + exponent) as $u_scalar) << $fraction_bits;
98-
$ty::from_bits(self | exponent_bits)
98+
// TODO: use from_bits when min compiler > 1.25 (see #545)
99+
// $ty::from_bits(self | exponent_bits)
100+
unsafe{ mem::transmute(self | exponent_bits) }
99101
}
100102
}
101103

src/distributions/other.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<T> Distribution<Wrapping<T>> for Standard where Standard: Distribution<T> {
180180
mod tests {
181181
use {Rng, RngCore, Standard};
182182
use distributions::Alphanumeric;
183-
#[cfg(all(not(feature="std"), feature="alloc"))] use alloc::String;
183+
#[cfg(all(not(feature="std"), feature="alloc"))] use alloc::string::String;
184184

185185
#[test]
186186
fn test_misc() {

src/distributions/weighted.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use ::core::cmp::PartialOrd;
1515
use ::{Error, ErrorKind};
1616

1717
// Note that this whole module is only imported if feature="alloc" is enabled.
18-
#[cfg(not(feature="std"))] use alloc::Vec;
18+
#[cfg(not(feature="std"))] use alloc::vec::Vec;
1919

2020
/// A distribution using weighted sampling to pick a discretely selected item.
2121
///

src/seq.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
#[cfg(feature="alloc")] use core::ops::Index;
1616

1717
#[cfg(feature="std")] use std::vec;
18-
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::{vec, Vec};
18+
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec;
19+
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec;
1920
// BTreeMap is not as fast in tests, but better than nothing.
2021
#[cfg(feature="std")] use std::collections::HashMap;
21-
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::btree_map::BTreeMap;
22+
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::collections::BTreeMap;
2223

2324

2425
use super::Rng;
@@ -599,7 +600,7 @@ mod test {
599600
#[cfg(feature = "alloc")] use {Rng, SeedableRng};
600601
#[cfg(feature = "alloc")] use prng::XorShiftRng;
601602
#[cfg(all(feature="alloc", not(feature="std")))]
602-
use alloc::Vec;
603+
use alloc::vec::Vec;
603604

604605
#[test]
605606
fn test_slice_choose() {

0 commit comments

Comments
 (0)