From 38c3f750eb8dad6b37a203edaf9faa8a9cb8bf32 Mon Sep 17 00:00:00 2001 From: Ralph Tandetzky <3224434+ralphtandetzky@users.noreply.github.com> Date: Sun, 16 Feb 2025 23:27:13 +0100 Subject: [PATCH 1/4] Add building the crate to CI. Previously, only `cargo test` was run. Now `cargo build` with the same arguments is run before the tests. It looks like this makes a difference locally. --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 696cb12..bdd33f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -94,6 +94,11 @@ jobs: if: ${{ matrix.variant == 'minimal_versions' }} run: | cargo generate-lockfile -Z minimal-versions + - name: Build rand_distr + run: | + cargo build --target ${{ matrix.target }} --features=serde + cargo build --target ${{ matrix.target }} --no-default-features + cargo build --target ${{ matrix.target }} --no-default-features --features=std,std_math - name: Test rand_distr run: | cargo test --target ${{ matrix.target }} --features=serde From 94ee66177a57c0cedd270e125a56953fe245fd4d Mon Sep 17 00:00:00 2001 From: Ralph Tandetzky <3224434+ralphtandetzky@users.noreply.github.com> Date: Sun, 16 Feb 2025 23:57:31 +0100 Subject: [PATCH 2/4] Fix: Added missing import for `no_std` build. Before this commit, the command ```bash rustup run "1.63.0" cargo build --no-default-features ``` failed in the line ```rust let test_x = if symmetric { x.abs() } else { x }; ``` in file `src/utils.rs` with the error that `abs()` is not a method of `f64`. This is true for all `rustc` version up to `1.83.0`. From `1.84.0` onwards, this appears to be fixed without the change. However, the change is still necessary for `no_std` builds on older versions of `rustc`. --- src/utils.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils.rs b/src/utils.rs index ebc2fb5..fb3038c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -9,6 +9,8 @@ //! Math helper functions use crate::ziggurat_tables; +#[allow(unused_imports)] +use num_traits::Float; // Used for `no_std` to get `f64::abs()` working before `rustc 1.84` use rand::distr::hidden_export::IntoFloat; use rand::Rng; From 4db72267ae178c25bf9e6541da135c110275b7fe Mon Sep 17 00:00:00 2001 From: Ralph Tandetzky <3224434+ralphtandetzky@users.noreply.github.com> Date: Sun, 16 Feb 2025 23:59:43 +0100 Subject: [PATCH 3/4] Updated `CHANGELOG.md`. --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a75e125..d36a0fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. 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). +## [Unreleased] + +### Testing +- Added building the crate to CI + +### Fixes +- Fix missing import for `no_std` builds + ## [0.5.0] - 2025-01-27 ### Dependencies and features From c9556cf9bd79dd6488a0285dbf60ecafab52d7c2 Mon Sep 17 00:00:00 2001 From: Ralph Tandetzky <3224434+ralphtandetzky@users.noreply.github.com> Date: Mon, 17 Feb 2025 22:58:22 +0100 Subject: [PATCH 4/4] Version bump to 0.5.1 --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- distr_test/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d36a0fa..293072c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. 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). -## [Unreleased] +## [0.5.1] ### Testing - Added building the crate to CI diff --git a/Cargo.toml b/Cargo.toml index 0e3d709..02c7cea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand_distr" -version = "0.5.0" +version = "0.5.1" authors = ["The Rand Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/distr_test/Cargo.toml b/distr_test/Cargo.toml index 9181d86..a9f9900 100644 --- a/distr_test/Cargo.toml +++ b/distr_test/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dev-dependencies] -rand_distr = { path = "..", version = "0.5.0", default-features = false, features = ["alloc"] } +rand_distr = { path = "..", version = "0.5.1", default-features = false, features = ["alloc"] } rand = { version = "0.9.0", features = ["small_rng"] } num-traits = "0.2.19" # Special functions for testing distributions