diff --git a/Cargo.toml b/Cargo.toml index 073f6edcd99..8149c0287dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ default = ["std"] nightly = ["i128_support"] # enables all features requiring nightly rust std = ["rand-core/std", "winapi", "libc"] # default feature; without this rand uses libcore -alloc = [] # enables Vec and Box support without std +alloc = ["rand-core/alloc"] # enables Vec and Box support without std i128_support = [] # enables i128 and u128 support diff --git a/rand-core/src/lib.rs b/rand-core/src/lib.rs index ac2e84bb025..b6794081683 100644 --- a/rand-core/src/lib.rs +++ b/rand-core/src/lib.rs @@ -34,6 +34,7 @@ #![deny(missing_debug_implementations)] #![cfg_attr(not(feature="std"), no_std)] +#![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))] #[cfg(feature="std")] extern crate core; #[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc;