From bd225a70a43c9b86cdbda1817433acbdef69840e Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 3 Oct 2018 08:41:17 +0100 Subject: [PATCH] Fix rand_core 0.3 dependency; hack tests --- .travis.yml | 15 ++++++++------- appveyor.yml | 4 ++-- rand_core/Cargo.toml | 6 ++---- src/distributions/other.rs | 2 +- src/seq.rs | 6 +++--- utils/ci/script.sh | 4 ++-- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d3633b9a6d..089ae4cf5f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,26 +6,27 @@ sudo: false # - pinned stable, latest stable, beta and nightly Rust releases # - Linux, OS X, Android, iOS, bare metal (i.e. no_std) # - x86_64, ARMv7, a Big-Endian arch (MIPS) +# HACK: use --tests to disable doc-tests for rand_core 0.2 (see #619) matrix: include: - rust: 1.22.0 install: script: - cargo test --tests --no-default-features - - cargo test --package rand_core --no-default-features + - cargo test --package rand_core:0.2.2 --no-default-features --tests - cargo test --features serde1,log - rust: stable os: osx install: script: - cargo test --tests --no-default-features - - cargo test --package rand_core --no-default-features + - cargo test --package rand_core:0.2.2 --no-default-features --tests - cargo test --features serde1,log - rust: beta install: script: - cargo test --tests --no-default-features - - cargo test --package rand_core --no-default-features + - cargo test --package rand_core:0.2.2 --no-default-features --tests - cargo test --features serde1,log - rust: nightly install: @@ -34,13 +35,13 @@ matrix: - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH script: - cargo test --tests --no-default-features --features=alloc - - cargo test --package rand_core --no-default-features --features=alloc,serde1 + - cargo test --package rand_core:0.2.2 --no-default-features --features=alloc,serde1 --tests - cargo test --features serde1,log,nightly,alloc - cargo test --all --benches # remove cached documentation, otherwise files from previous PRs can get included - - rm -rf target/doc - - cargo doc --no-deps --all --all-features - - cargo deadlinks --dir target/doc + #- rm -rf target/doc + #- cargo doc --no-deps --all --all-features + #- cargo deadlinks --dir target/doc after_success: - travis-cargo --only nightly doc-upload diff --git a/appveyor.yml b/appveyor.yml index 97d3ce6fda1..a2bf7f98917 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,8 +32,8 @@ install: build: false test_script: - - cargo test --all # cannot use --all and --features together + - cargo test --all --tests # cannot use --all and --features together - cargo test --all --benches - cargo test --features serde1,log,nightly - cargo test --tests --no-default-features --features=alloc,serde1 - - cargo test --package rand_core --no-default-features --features=alloc,serde1 + - cargo test --package rand_core:0.2.2 --no-default-features --features=alloc,serde1 --tests diff --git a/rand_core/Cargo.toml b/rand_core/Cargo.toml index d5fad697393..d74b5cfd565 100644 --- a/rand_core/Cargo.toml +++ b/rand_core/Cargo.toml @@ -20,9 +20,7 @@ appveyor = { repository = "rust-random/rand" } [features] std = ["rand_core/std"] # use std library; should be default but for above bug alloc = ["rand_core/alloc"] # enables Vec and Box support without std -serde1 = ["rand_core/serde", "rand_core/serde_derive"] # enables serde for BlockRng wrapper +serde1 = ["rand_core/serde1"] # enables serde for BlockRng wrapper [dependencies] -rand_core = "0.3" -serde = { version = "1", optional = true } -serde_derive = { version = "^1.0.38", optional = true } +rand_core = { version = "0.3", default-features = false } diff --git a/src/distributions/other.rs b/src/distributions/other.rs index ef8ce63b8b0..f23d2b85e51 100644 --- a/src/distributions/other.rs +++ b/src/distributions/other.rs @@ -174,7 +174,7 @@ impl Distribution> for Standard where Standard: Distribution { 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() { diff --git a/src/seq.rs b/src/seq.rs index 68f7ab08edc..4170677f69f 100644 --- a/src/seq.rs +++ b/src/seq.rs @@ -15,9 +15,9 @@ use super::Rng; // This crate is only enabled when either std or alloc is available. // BTreeMap is not as fast in tests, but better than nothing. #[cfg(feature="std")] use std::collections::HashMap; -#[cfg(not(feature="std"))] use alloc::btree_map::BTreeMap; +#[cfg(not(feature="std"))] use alloc::collections::btree_map::BTreeMap; -#[cfg(not(feature="std"))] use alloc::Vec; +#[cfg(not(feature="std"))] use alloc::vec::Vec; /// Randomly sample `amount` elements from a finite iterator. /// @@ -227,7 +227,7 @@ mod test { use super::*; use {XorShiftRng, Rng, SeedableRng}; #[cfg(not(feature="std"))] - use alloc::Vec; + use alloc::vec::Vec; #[test] fn test_sample_iter() { diff --git a/utils/ci/script.sh b/utils/ci/script.sh index 21188f38d29..d0fec19a6a6 100644 --- a/utils/ci/script.sh +++ b/utils/ci/script.sh @@ -13,12 +13,12 @@ main() { if [ ! -z $NIGHTLY ]; then # have nightly Rust cross test --tests --no-default-features --features alloc --target $TARGET - cross test --package rand_core --no-default-features --features alloc --target $TARGET + cross test --package rand_core:0.2.2 --no-default-features --features alloc --target $TARGET --tests cross test --features serde1,log,nightly,alloc --target $TARGET cross test --all --benches --target $TARGET else # have stable Rust cross test --tests --no-default-features --target $TARGET - cross test --package rand_core --no-default-features --target $TARGET + cross test --package rand_core:0.2.2 --no-default-features --target $TARGET --tests cross test --features serde1,log --target $TARGET fi }