Ad
  • Default User Avatar

    Rust: The tests seem to have issues.

    I got this compilation error:

    error[E0308]: mismatched types
       --> src/lib.rs:129:9
        |
    129 |         assert_eq!(partitions(n), size);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
        |
        = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    For more information about this error, try `rustc --explain E0308`.
    error: could not compile `challenge` due to previous error
    
    
    NOTE: Line numbers in error messages can be incorrect due to concatenation.
    

    I suspect the size variable in the test is u32 instead of usize.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Why use isize rather than usize?

  • Custom User Avatar

    Duplicate, as mentioned by @jcsahnwaldt below.