Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lots of usize/u32 issues? #219

Closed
colemickens opened this issue Nov 27, 2021 · 3 comments
Closed

lots of usize/u32 issues? #219

colemickens opened this issue Nov 27, 2021 · 3 comments

Comments

@colemickens
Copy link

This is the result of me trying to build ripasso-cursive via the nix package (nixos-unstable channel)

   Compiling ripasso-cursive v0.5.1 (/build/source/cursive)
   Compiling unic-langid v0.9.0
   Compiling quote v1.0.6
   Compiling jobserver v0.1.21
   Compiling xcb v0.8.2
   Compiling mio v0.7.0
   Compiling signal-hook-registry v1.2.0
   Compiling time v0.1.43
   Compiling parking_lot_core v0.7.2
   Compiling cstr-argument v0.1.1
   Compiling aho-corasick v0.7.10
   Compiling smallvec v0.6.13
   Compiling lexical-core v0.6.2
   Compiling gettext v0.4.0
   Compiling crossbeam-channel v0.4.2
   Compiling toml v0.5.6
   Compiling cc v1.0.54
   Compiling const-random-macro v0.1.8
   Compiling rand_core v0.5.1
   Compiling signal-hook v0.1.15
   Compiling parking_lot v0.10.2
   Compiling unicode-normalization v0.1.9
   Compiling regex v1.3.9
   Compiling chrono v0.4.11
   Compiling libz-sys v1.0.25
   Compiling openssl-sys v0.9.58
   Compiling libssh2-sys v0.2.17
   Compiling libgit2-sys v0.12.9+1.0.1
   Compiling const-random v0.1.8
   Compiling rand_chacha v0.2.2
   Compiling darling_core v0.10.2
   Compiling gpgme v0.9.2
   Compiling crossterm v0.17.7
   Compiling idna v0.2.0
error[E0308]: mismatched types
  --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/bhcomp.rs:62:24
   |
62 |     let bytes = bits / Limb::BITS;
   |                        ^^^^^^^^^^ expected `usize`, found `u32`

error[E0277]: cannot divide `usize` by `u32`
  --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/bhcomp.rs:62:22
   |
62 |     let bytes = bits / Limb::BITS;
   |                      ^ no implementation for `usize / u32`
   |
   = help: the trait `Div<u32>` is not implemented for `usize`

error[E0308]: mismatched types
   --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/bigcomp.rs:158:55
    |
158 |     let nlz = den.leading_zeros().wrapping_sub(wlz) & (u32::BITS - 1);
    |                                                       ^^^^^^^^^^^^^^^ expected `usize`, found `u32`

error[E0277]: no implementation for `usize & u32`
   --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/bigcomp.rs:158:53
    |
158 |     let nlz = den.leading_zeros().wrapping_sub(wlz) & (u32::BITS - 1);
    |                                                     ^ no implementation for `usize & u32`
    |
    = help: the trait `BitAnd<u32>` is not implemented for `usize`

error[E0308]: mismatched types
   --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/bigcomp.rs:176:40
    |
176 |         let (q, r) = shift.ceil_divmod(Limb::BITS);
    |                                        ^^^^^^^^^^ expected `usize`, found `u32`
    |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
    |
176 |         let (q, r) = shift.ceil_divmod(Limb::BITS.try_into().unwrap());
    |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:2071:27
     |
2071 |     let rs = Limb::BITS - s;
     |                           ^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:2071:25
     |
2071 |     let rs = Limb::BITS - s;
     |                         ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1049:42
     |
1049 |     let mut count = index.saturating_mul(Limb::BITS);
     |                                          ^^^^^^^^^^ expected `usize`, found `u32`
     |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
     |
1049 |     let mut count = index.saturating_mul(Limb::BITS.try_into().unwrap());
     |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1064:28
     |
1064 |     Limb::BITS.checked_mul(x.len())
     |                            ^^^^^^^ expected `u32`, found `usize`
     |
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
     |
1064 |     Limb::BITS.checked_mul(x.len().try_into().unwrap())
     |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1065:22
     |
1065 |         .map(|v| v - nlz)
     |                      ^^^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1065:20
     |
1065 |         .map(|v| v - nlz)
     |                    ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1066:20
     |
1066 |         .unwrap_or(usize::max_value())
     |                    ^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize`
     |
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
     |
1066 |         .unwrap_or(usize::max_value().try_into().unwrap())
     |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1064:5
     |
1060 |   pub fn bit_length(x: &[Limb]) -> usize {
     |                                    ----- expected `usize` because of return type
...
1064 | /     Limb::BITS.checked_mul(x.len())
1065 | |         .map(|v| v - nlz)
1066 | |         .unwrap_or(usize::max_value())
     | |______________________________________^ expected `usize`, found `u32`
     |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
     |
1064 ~     Limb::BITS.checked_mul(x.len())
1065 +         .map(|v| v - nlz)
1066 +         .unwrap_or(usize::max_value()).try_into().unwrap()
     |

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1091:23
     |
1091 |     debug_assert!(n < bits && n != 0);
     |                       ^^^^ expected `usize`, found `u32`
     |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
     |
1091 |     debug_assert!(n < bits.try_into().unwrap() && n != 0);
     |                       ~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1098:25
     |
1098 |     let lshift = bits - n;
     |                         ^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1098:23
     |
1098 |     let lshift = bits - n;
     |                       ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1140:19
     |
1140 |     let rem = n % bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot mod `usize` by `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1140:17
     |
1140 |     let rem = n % bits;
     |                 ^ no implementation for `usize % u32`
     |
     = help: the trait `Rem<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1141:19
     |
1141 |     let div = n / bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot divide `usize` by `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1141:17
     |
1141 |     let div = n / bits;
     |                 ^ no implementation for `usize / u32`
     |
     = help: the trait `Div<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1197:23
     |
1197 |     debug_assert!(n < bits);
     |                       ^^^^ expected `usize`, found `u32`
     |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
     |
1197 |     debug_assert!(n < bits.try_into().unwrap());
     |                       ~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1207:25
     |
1207 |     let rshift = bits - n;
     |                         ^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1207:23
     |
1207 |     let rshift = bits - n;
     |                       ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1259:19
     |
1259 |     let rem = n % bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot mod `usize` by `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1259:17
     |
1259 |     let rem = n % bits;
     |                 ^ no implementation for `usize % u32`
     |
     = help: the trait `Rem<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1260:19
     |
1260 |     let div = n / bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot divide `usize` by `u32`
    --> /build/ripasso-cursive-0.5.1-vendor.tar.gz/lexical-core/src/atof/algorithm/math.rs:1260:17
     |
1260 |     let div = n / bits;
     |                 ^ no implementation for `usize / u32`
     |
     = help: the trait `Div<u32>` is not implemented for `usize`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `lexical-core` due to 27 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed
@alexanderkjall
Copy link
Collaborator

This might be that lexical-core broke in new version of cargo, see Alexhuszagh/rust-lexical#55

I'll fix this by doing a cargo update and doing a new 0.5.x release. Just have to reproduce this locally.

@alexanderkjall
Copy link
Collaborator

I just released version 0.5.2, that should fix this.

@stigtsp
Copy link
Contributor

stigtsp commented Dec 7, 2021

Updated in nixpkgs by NixOS/nixpkgs#149198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants