diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index 80c0ec3d965..00000000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: gh-pages - -on: - push: - branches: - - master - -jobs: - deploy: - name: GH-pages documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - name: doc (rand) - env: - RUSTDOCFLAGS: --cfg doc_cfg - # --all builds all crates, but with default features for other crates (okay in this case) - run: | - cargo doc --all --features nightly,serde1,getrandom,small_rng - cp utils/redirect.html target/doc/index.html - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./target/doc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..131590b3ade --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,18 @@ +name: Publish to crates.io and create GitHub release +on: + push: + tags: ['[0-9].[0-9].*', '[0-9].[1-9][0-9].*'] +jobs: + # Source: https://crates.io/docs/trusted-publishing + publish: + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - uses: actions/checkout@v6 + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + - run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e90e380645..03aa0674240 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,12 +87,12 @@ jobs: - name: Test rand (all stable features, non-MSRV) if: ${{ matrix.toolchain != '1.36.0' }} run: | - cargo test --target ${{ matrix.target }} --features=serde1,log,small_rng,min_const_gen + cargo test --target ${{ matrix.target }} --features=serde1,small_rng,min_const_gen - name: Test rand (all stable features, MSRV) if: ${{ matrix.toolchain == '1.36.0' }} run: | # const generics are not stable on 1.36.0 - cargo test --target ${{ matrix.target }} --features=serde1,log,small_rng + cargo test --target ${{ matrix.target }} --features=serde1,small_rng - name: Test rand_core run: | cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml @@ -137,7 +137,7 @@ jobs: - name: Test run: | # all stable features: - cross test --no-fail-fast --target ${{ matrix.target }} --features=serde1,log,small_rng + cross test --no-fail-fast --target ${{ matrix.target }} --features=serde1,small_rng cross test --no-fail-fast --target ${{ matrix.target }} --examples cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --features=serde1 @@ -156,7 +156,7 @@ jobs: - name: Test rand run: | cargo miri test --no-default-features --lib --tests - cargo miri test --features=log,small_rng + cargo miri test --features=small_rng cargo miri test --manifest-path rand_core/Cargo.toml cargo miri test --manifest-path rand_core/Cargo.toml --features=serde1 cargo miri test --manifest-path rand_core/Cargo.toml --no-default-features diff --git a/CHANGELOG.md b/CHANGELOG.md index b0872af6d39..da9f4592cba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md). You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful. +## [0.8.6] - 2026-04-14 +This release back-ports a fix from v0.10. See also [#1763]. + +### Changes +- Deprecate feature `log` (#1764) + +[#1763]: https://github.com/rust-random/rand/pull/1763 + ## [0.8.5] - 2021-08-20 ### Fixes - Fix build on non-32/64-bit architectures (#1144) diff --git a/Cargo.toml b/Cargo.toml index 98ba373c68f..d6b36303a46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand" -version = "0.8.5" +version = "0.8.6" authors = ["The Rand Project Developers", "The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -64,7 +64,6 @@ members = [ [dependencies] rand_core = { path = "rand_core", version = "0.6.0" } -log = { version = "0.4.4", optional = true } serde = { version = "1.0.103", features = ["derive"], optional = true } rand_chacha = { path = "rand_chacha", version = "0.3.0", default-features = false, optional = true } diff --git a/README.md b/README.md index 44c2e4d518e..b606a33e624 100644 --- a/README.md +++ b/README.md @@ -118,10 +118,6 @@ Rand is built with these features enabled by default: - `std_rng` enables inclusion of `StdRng`, `thread_rng` and `random` (the latter two *also* require that `std` be enabled) -Optionally, the following dependencies can be enabled: - -- `log` enables logging via the `log` crate - Additionally, these features configure Rand: - `small_rng` enables inclusion of the `SmallRng` PRNG diff --git a/src/lib.rs b/src/lib.rs index 6d847180111..d4f87d37c5b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,37 +59,6 @@ #[cfg(feature = "std")] extern crate std; #[cfg(feature = "alloc")] extern crate alloc; -#[allow(unused)] -macro_rules! trace { ($($x:tt)*) => ( - #[cfg(feature = "log")] { - log::trace!($($x)*) - } -) } -#[allow(unused)] -macro_rules! debug { ($($x:tt)*) => ( - #[cfg(feature = "log")] { - log::debug!($($x)*) - } -) } -#[allow(unused)] -macro_rules! info { ($($x:tt)*) => ( - #[cfg(feature = "log")] { - log::info!($($x)*) - } -) } -#[allow(unused)] -macro_rules! warn { ($($x:tt)*) => ( - #[cfg(feature = "log")] { - log::warn!($($x)*) - } -) } -#[allow(unused)] -macro_rules! error { ($($x:tt)*) => ( - #[cfg(feature = "log")] { - log::error!($($x)*) - } -) } - // Re-exports from rand_core pub use rand_core::{CryptoRng, Error, RngCore, SeedableRng}; diff --git a/src/rngs/adapter/reseeding.rs b/src/rngs/adapter/reseeding.rs index ae3fcbb2fc2..52a2aa7a95f 100644 --- a/src/rngs/adapter/reseeding.rs +++ b/src/rngs/adapter/reseeding.rs @@ -241,18 +241,10 @@ where fn reseed_and_generate( &mut self, results: &mut ::Results, global_fork_counter: usize, ) { - #![allow(clippy::if_same_then_else)] // false positive - if self.is_forked(global_fork_counter) { - info!("Fork detected, reseeding RNG"); - } else { - trace!("Reseeding RNG (periodic reseed)"); - } - let num_bytes = results.as_ref().len() * size_of::<::Item>(); if let Err(e) = self.reseed() { - warn!("Reseeding RNG failed: {}", e); - let _ = e; + panic!("Reseeding RNG failed: {e}"); } self.fork_counter = global_fork_counter;