Merge pull request #703 from dhardy/master
Disable std feature by default in rand_core and rand_jitter
diff --git a/Cargo.toml b/Cargo.toml
index ba75089..ccdc008 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,9 +46,9 @@
]
[dependencies]
-rand_core = { path = "rand_core", version = "0.3", default-features = false }
+rand_core = { path = "rand_core", version = "0.4" }
rand_pcg = { path = "rand_pcg", version = "0.1" }
-rand_jitter = { path = "rand_jitter", version = "0.1", default-features = false }
+rand_jitter = { path = "rand_jitter", version = "0.1" }
rand_os = { path = "rand_os", version = "0.1", optional = true }
# only for deprecations and benches:
rand_isaac = { path = "rand_isaac", version = "0.1" }
@@ -84,4 +84,4 @@
all-features = true
[patch.crates-io]
-rand_core = { path = "rand_core", version = "0.3", default-features = false }
+rand_core = { path = "rand_core", version = "0.4" }
diff --git a/appveyor.yml b/appveyor.yml
index 70e4326..70a8cad 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -37,13 +37,6 @@
- cargo test --features=serde1,log
- cargo test --benches --features=nightly
- cargo test --examples
- - cargo test --package rand_core
- - cargo test --package rand_core --no-default-features --features=alloc
- - cargo test --package rand_isaac --features=serde1
- - cargo test --package rand_xorshift --features=serde1
- - cargo test --package rand_xoshiro
- - cargo test --package rand_chacha
- - cargo test --package rand_hc
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
diff --git a/rand_chacha/Cargo.toml b/rand_chacha/Cargo.toml
index 028428c..f8cbe7f 100644
--- a/rand_chacha/Cargo.toml
+++ b/rand_chacha/Cargo.toml
@@ -19,7 +19,7 @@
appveyor = { repository = "rust-random/rand" }
[dependencies]
-rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
+rand_core = { path = "../rand_core", version = "0.4" }
[build-dependencies]
autocfg = "0.1"
diff --git a/rand_core/CHANGELOG.md b/rand_core/CHANGELOG.md
index 2cbb259..7f2d797 100644
--- a/rand_core/CHANGELOG.md
+++ b/rand_core/CHANGELOG.md
@@ -4,6 +4,9 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.4.0] - 2019-01-24
+- Disable the `std` feature by default (#702)
+
## [0.3.0] - 2018-09-24
- Add `SeedableRng::seed_from_u64` for convenient seeding. (#537)
diff --git a/rand_core/Cargo.toml b/rand_core/Cargo.toml
index 1678773..340fb3a 100644
--- a/rand_core/Cargo.toml
+++ b/rand_core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rand_core"
-version = "0.3.0"
+version = "0.4.0"
authors = ["The Rand Project Developers", "The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
@@ -18,7 +18,6 @@
appveyor = { repository = "rust-random/rand" }
[features]
-default = ["std"]
std = ["alloc"] # use std library; should be default but for above bug
alloc = [] # enables Vec and Box support without std
serde1 = ["serde", "serde_derive"] # enables serde for BlockRng wrapper
diff --git a/rand_core/README.md b/rand_core/README.md
index dee6504..ef076b9 100644
--- a/rand_core/README.md
+++ b/rand_core/README.md
@@ -44,13 +44,14 @@
`rand_core` supports `no_std` and `alloc`-only configurations, as well as full
`std` functionality. The differences between `no_std` and full `std` are small,
-comprising `RngCore` support for `Box<R>` types where `R: RngCore`, as well as
+comprising `RngCore` support for `Box<R>` types where `R: RngCore`,
+`std::io::Read` support for types supporting `RngCore`, and
extensions to the `Error` type's functionality.
-Due to [rust-lang/cargo#1596](https://github.com/rust-lang/cargo/issues/1596),
-`rand_core` is built without `std` support by default. Since features are
-unioned across the whole dependency tree, any crate using `rand` with its
-default features will also enable `std` support in `rand_core`.
+The `std` feature is *not enabled by default*. This is primarily to avoid build
+problems where one crate implicitly requires `rand_core` with `std` support and
+another crate requires `rand` *without* `std` support. However, the `rand` crate
+continues to enable `std` support by default, both for itself and `rand_core`.
The `serde1` feature can be used to derive `Serialize` and `Deserialize` for RNG
implementations that use the `BlockRng` or `BlockRng64` wrappers.
diff --git a/rand_hc/Cargo.toml b/rand_hc/Cargo.toml
index ed5dd5b..b4aa08e 100644
--- a/rand_hc/Cargo.toml
+++ b/rand_hc/Cargo.toml
@@ -18,4 +18,4 @@
appveyor = { repository = "rust-random/rand" }
[dependencies]
-rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
+rand_core = { path = "../rand_core", version = "0.4" }
diff --git a/rand_isaac/Cargo.toml b/rand_isaac/Cargo.toml
index b35d0ab..16d0cab 100644
--- a/rand_isaac/Cargo.toml
+++ b/rand_isaac/Cargo.toml
@@ -21,7 +21,7 @@
serde1 = ["serde", "serde_derive", "rand_core/serde1"]
[dependencies]
-rand_core = { path = "../rand_core", version = "0.3", default-features=false }
+rand_core = { path = "../rand_core", version = "0.4" }
serde = { version = "1", optional = true }
serde_derive = { version = "^1.0.38", optional = true }
diff --git a/rand_jitter/CHANGELOG.md b/rand_jitter/CHANGELOG.md
index b23c990..1e39916 100644
--- a/rand_jitter/CHANGELOG.md
+++ b/rand_jitter/CHANGELOG.md
@@ -4,5 +4,5 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [0.1.0] - 2019-01-04
+## [0.1.0] - 2019-01-24
Initial release.
diff --git a/rand_jitter/Cargo.toml b/rand_jitter/Cargo.toml
index 22cc80e..e04dcc1 100644
--- a/rand_jitter/Cargo.toml
+++ b/rand_jitter/Cargo.toml
@@ -14,7 +14,7 @@
appveyor = { repository = "rust-random/rand" }
[dependencies]
-rand_core = { path = "../rand_core", version = "0.3", default-features = false }
+rand_core = { path = "../rand_core", version = "0.4" }
log = { version = "0.4", optional = true }
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
@@ -24,6 +24,4 @@
winapi = { version = "0.3", features = ["profileapi"] }
[features]
-default = ["std"]
-std = []
-
+std = ["rand_core/std"]
diff --git a/rand_jitter/README.md b/rand_jitter/README.md
index 4da9d3e..cda5d62 100644
--- a/rand_jitter/README.md
+++ b/rand_jitter/README.md
@@ -22,6 +22,12 @@
- [API documentation (docs.rs)](https://docs.rs/rand_jitter)
- [Changelog](CHANGELOG.md)
+## Features
+
+This crate has optional `std` support which is *disabled by default*;
+this feature is required to provide the `JitterRng::new` function;
+without `std` support a timer must be supplied via `JitterRng::new_with_timer`.
+
## Quality testing
`JitterRng::new()` has build-in, but limited, quality testing, however
diff --git a/rand_jitter/tests/mod.rs b/rand_jitter/tests/mod.rs
index ba7e54c..6820c20 100644
--- a/rand_jitter/tests/mod.rs
+++ b/rand_jitter/tests/mod.rs
@@ -2,8 +2,10 @@
extern crate rand_core;
use rand_jitter::JitterRng;
+#[cfg(feature = "std")]
use rand_core::RngCore;
+#[cfg(feature = "std")]
#[test]
fn test_jitter_init() {
// Because this is a debug build, measurements here are not representive
diff --git a/rand_os/Cargo.toml b/rand_os/Cargo.toml
index af97081..92aa0f4 100644
--- a/rand_os/Cargo.toml
+++ b/rand_os/Cargo.toml
@@ -15,7 +15,7 @@
appveyor = { repository = "rust-random/rand" }
[dependencies]
-rand_core = { path = "../rand_core", version = "0.3", default-features = false }
+rand_core = { path = "../rand_core", version = "0.4", features = ["std"] }
log = { version = "0.4", optional = true }
[target.'cfg(unix)'.dependencies]
diff --git a/rand_pcg/Cargo.toml b/rand_pcg/Cargo.toml
index c2fcb7d..5ebf2db 100644
--- a/rand_pcg/Cargo.toml
+++ b/rand_pcg/Cargo.toml
@@ -22,7 +22,7 @@
serde1 = ["serde", "serde_derive"]
[dependencies]
-rand_core = { path = "../rand_core", version = "0.3", default-features=false }
+rand_core = { path = "../rand_core", version = "0.4" }
serde = { version = "1", optional = true }
serde_derive = { version = "^1.0.38", optional = true }
diff --git a/rand_xorshift/Cargo.toml b/rand_xorshift/Cargo.toml
index 114fee9..e01ddc2 100644
--- a/rand_xorshift/Cargo.toml
+++ b/rand_xorshift/Cargo.toml
@@ -21,7 +21,7 @@
serde1 = ["serde", "serde_derive"]
[dependencies]
-rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
+rand_core = { path = "../rand_core", version = "0.4" }
serde = { version = "1", optional = true }
serde_derive = { version = "^1.0.38", optional = true }
diff --git a/rand_xoshiro/Cargo.toml b/rand_xoshiro/Cargo.toml
index 8d174c7..c518baa 100644
--- a/rand_xoshiro/Cargo.toml
+++ b/rand_xoshiro/Cargo.toml
@@ -13,7 +13,7 @@
[dependencies]
byteorder = { version = "1", default-features=false }
-rand_core = { path = "../rand_core", version = "0.3", default-features=false }
+rand_core = { path = "../rand_core", version = "0.4" }
[dev-dependencies]
rand = { path = "..", version = "0.6", default-features=false } # needed for doctests