Skip to content

tests fail to compile with Rust 1.87 #70

Description

@decathorpe

It looks like the stabilization of https://doc.rust-lang.org/stable/std/primitive.u8.html#method.is_multiple_of causes the tests to fail to compile due to a type mismatch:

error[E0308]: mismatched types
    --> src/lib.rs:1021:50
     |
1021 |                 assert!((0 as $T).is_multiple_of(&(0 as $T)));
     |                                   -------------- ^^^^^^^^^^ expected `u8`, found `&u8`
     |                                   |
     |                                   arguments to this method are incorrect
...
1052 | impl_integer_for_usize!(u8, test_integer_u8);
     | -------------------------------------------- in this macro invocation
     |
note: method defined here
    --> /builddir/build/BUILD/rust-1.87.0-build/rustc-1.87.0-src/library/core/src/num/mod.rs:436:5
     = note: this error originates in the macro `impl_integer_for_usize` which comes from the expansion of the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using clone here
     |
1021 |                 assert!((0 as $T).is_multiple_of(&(0 as $T).clone()));
     |                                                            ++++++++

(and many more errors like this one)

It looks like the method definitions in this crate and the one in std aren't compatible:
https://docs.rs/num-integer/latest/num_integer/trait.Integer.html#tymethod.is_multiple_of

→ one uses &Self for the "other" type, one uses Self for the "rhs" type.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions