diff --git a/library/core/src/random.rs b/library/core/src/random.rs index 06f4f30efe2b5..0bb7b0b01aead 100644 --- a/library/core/src/random.rs +++ b/library/core/src/random.rs @@ -3,7 +3,7 @@ use crate::ops::RangeFull; /// A source of randomness. -#[unstable(feature = "random", issue = "130703")] +#[stable(feature = "random_source", since = "CURRENT_RUSTC_VERSION")] pub trait RandomSource { /// Fills `bytes` with random bytes. /// @@ -11,6 +11,7 @@ pub trait RandomSource { /// with a larger buffer. A `RandomSource` is allowed to return different bytes for those two /// cases. For instance, this allows a `RandomSource` to generate a word at a time and throw /// part of it away if not needed. + #[stable(feature = "random_source", since = "CURRENT_RUSTC_VERSION")] fn fill_bytes(&mut self, bytes: &mut [u8]); } diff --git a/library/std/src/random.rs b/library/std/src/random.rs index a18dcf98ec7fc..1e11451e8d493 100644 --- a/library/std/src/random.rs +++ b/library/std/src/random.rs @@ -1,7 +1,9 @@ //! Random value generation. #[unstable(feature = "random", issue = "130703")] -pub use core::random::*; +pub use core::random::Distribution; +#[stable(feature = "random_source", since = "CURRENT_RUSTC_VERSION")] +pub use core::random::RandomSource; use crate::sys::random as sys; @@ -55,10 +57,10 @@ use crate::sys::random as sys; /// [`getrandom`]: https://www.man7.org/linux/man-pages/man2/getrandom.2.html /// [`/dev/urandom`]: https://www.man7.org/linux/man-pages/man4/random.4.html #[derive(Default, Debug, Clone, Copy)] -#[unstable(feature = "random", issue = "130703")] +#[stable(feature = "random_source", since = "CURRENT_RUSTC_VERSION")] pub struct DefaultRandomSource; -#[unstable(feature = "random", issue = "130703")] +#[stable(feature = "random_source", since = "CURRENT_RUSTC_VERSION")] impl RandomSource for DefaultRandomSource { fn fill_bytes(&mut self, bytes: &mut [u8]) { sys::fill_bytes(bytes)