smol-rs / fastrand

A simple and fast random number generator
Apache License 2.0
409 stars 35 forks source link

Compilation errors with non-latest stable cargo/rustc #1

Closed joshuarli closed 4 years ago

joshuarli commented 4 years ago

ref: https://github.com/Stebalien/tempfile/pull/118#issuecomment-645553590

Looks something like this:

error[E0599]: no associated item named `MAX` found for type `isize` in the current scope
   --> C:\Users\appveyor\.cargo\registry\src\github.com-1ecc6299db9ec823\fastrand-1.1.0\src\lib.rs:177:46
    |
177 |               if low == $t::MIN && high == $t::MAX {
    |                                                ^^^ associated item not found in `isize`
...
282 | / integer!(
283 | |     isize,
284 | |     gen_u32,
285 | |     gen_mod_u32,
286 | |     "Generates a random `isize` in the given range."
287 | | );
    | |__- in this macro invocation

That's with rustc/cargo 1.32.0 in the CI failure.

I'm also using fastrand in https://github.com/joshuarli/epub-optimizer. It's way past terminal scrollback now but I believe I remember I was on 1.43.0 and got the same failure. Works on 1.44.0.

If there's interest I can verify the failure on 1.43.0, or bisect MSRV if I remembered incorrectly.

ghost commented 4 years ago

This should be fixed in just published v1.2.2

Let me know if the problem persists!

joshuarli commented 4 years ago

It still fails on 1.32.0, but that's kind of old. I didn't yet test 1.43.0, but do you know the new MSRV? I wasn't able to find anything quickly online.

joshuarli commented 4 years ago

If you do find out the new MSRV it would be nice to include that in the changelog and readme.

ghost commented 4 years ago

Published v1.2.3 and checked that it works with Rust 1.32.0

joshuarli commented 4 years ago

Nice, just confirmed in https://github.com/Stebalien/tempfile/pull/118. Thanks @stjepang! I really like fastrand btw. Hoping rust ecosystem moves towards it from rand, I'm betting majority rand users usecases would easily be satisfied with fastrand.