Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ matrix:
- rust: 1.22.0
install:
script:
- cargo test --tests --no-default-features
# TODO: use --tests instead of --lib on more recent compiler
- cargo test --lib --no-default-features
- cargo test --package rand_core --no-default-features
- cargo test --features serde1,log
- rust: stable
Expand Down
4 changes: 3 additions & 1 deletion src/distributions/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ macro_rules! float_impls {
// The exponent is encoded using an offset-binary representation
let exponent_bits: $u_scalar =
(($exponent_bias + exponent) as $u_scalar) << $fraction_bits;
$ty::from_bits(self | exponent_bits)
// TODO: use from_bits when min compiler > 1.25 (see #545)
// $ty::from_bits(self | exponent_bits)
unsafe{ mem::transmute(self | exponent_bits) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/distributions/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl<T> Distribution<Wrapping<T>> for Standard where Standard: Distribution<T> {
mod tests {
use {Rng, RngCore, Standard};
use distributions::Alphanumeric;
#[cfg(all(not(feature="std"), feature="alloc"))] use alloc::String;
#[cfg(all(not(feature="std"), feature="alloc"))] use alloc::string::String;

#[test]
fn test_misc() {
Expand Down
2 changes: 1 addition & 1 deletion src/distributions/weighted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use ::core::cmp::PartialOrd;
use ::{Error, ErrorKind};

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

/// A distribution using weighted sampling to pick a discretely selected item.
///
Expand Down
7 changes: 4 additions & 3 deletions src/seq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
#[cfg(feature="alloc")] use core::ops::Index;

#[cfg(feature="std")] use std::vec;
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::{vec, Vec};
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec;
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec;
// BTreeMap is not as fast in tests, but better than nothing.
#[cfg(feature="std")] use std::collections::HashMap;
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::btree_map::BTreeMap;
#[cfg(all(feature="alloc", not(feature="std")))] use alloc::collections::BTreeMap;


use super::Rng;
Expand Down Expand Up @@ -599,7 +600,7 @@ mod test {
#[cfg(feature = "alloc")] use {Rng, SeedableRng};
#[cfg(feature = "alloc")] use prng::XorShiftRng;
#[cfg(all(feature="alloc", not(feature="std")))]
use alloc::Vec;
use alloc::vec::Vec;

#[test]
fn test_slice_choose() {
Expand Down