Fix missing import for no_std builds#13
Merged
dhardy merged 4 commits intorust-random:masterfrom Feb 20, 2025
Merged
Conversation
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.
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`.
no_std builds
Closed
dhardy
approved these changes
Feb 17, 2025
Member
dhardy
left a comment
There was a problem hiding this comment.
Thanks. This looks good to me.
If you'd like an imminent release, please bump the version (0.5.1) and fix up the "[Unreleased]" line and I'll get this published.
Contributor
Author
Yes, please. I updated the version number and the |
dhardy
approved these changes
Feb 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGELOG.mdentrySummary
This PR fixes a missing import for
no_stdbuilds forrustcversion 1.83 and older.Motivation
When I tried to update my crate to
rand0.9.0 andrand_distr0.5.0, my CI failed. So I needed to do something about it. What can be better than fixing the issue upstream?Details
When
rand_distris build with--no-default-featuresusingrustup run "1.63.0" cargo build --no-default-featuresor any other
rustcversion up to 1.83, the build fails insrc/utils.rsin the linecomplaining that
f64does not offer the methodabs(). The added importfixes this issue.
In addition, I updated
.github/workflows/test.yml, socargo buildis executed for all existing test configurations. Previously, onlycargo testwas executed, but it looks like this is not sufficient to trigger the build failure.This fixes issue #12.