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

"expected u32, found usize" - Possible lexical core bug/issue during compilation? #33

Closed
naturepoker opened this issue Jul 17, 2021 · 0 comments

Comments

@naturepoker
Copy link

naturepoker commented Jul 17, 2021

As of July 17th 2021, ncgopher compilation following the instruction on the github page fails with below messages -

git clone https:/jansc/ncgopher.git
cd ncgopher/
cargo build

Eventually results in below output:

error[E0308]: mismatched types
  --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/bhcomp.rs:62:24
   |
62 |     let bytes = bits / Limb::BITS;
   |                        ^^^^^^^^^^ expected `usize`, found `u32`

error[E0277]: cannot divide `usize` by `u32`
  --> /home/.cargo/registry/src/lexical-core-0.7.4/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
   --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/bigcomp.rs:157:55
    |
157 |     let nlz = den.leading_zeros().wrapping_sub(wlz) & (u32::BITS - 1);
    |                                                       ^^^^^^^^^^^^^^^ expected `usize`, found `u32`

error[E0277]: no implementation for `usize & u32`
   --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/bigcomp.rs:157:53
    |
157 |     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
   --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/bigcomp.rs:175:40
    |
175 |         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
    |
175 |         let (q, r) = shift.ceil_divmod(Limb::BITS.try_into().unwrap());
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1043:42
     |
1043 |     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
     |
1043 |     let mut count = index.saturating_mul(Limb::BITS.try_into().unwrap());
     |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1058:28
     |
1058 |     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
     |
1058 |     Limb::BITS.checked_mul(x.len().try_into().unwrap())
     |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1059:22
     |
1059 |         .map(|v| v - nlz)
     |                      ^^^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1059:20
     |
1059 |         .map(|v| v - nlz)
     |                    ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1060:20
     |
1060 |         .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
     |
1060 |         .unwrap_or(usize::max_value().try_into().unwrap())
     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1058:5
     |
1054 |   pub fn bit_length(x: &[Limb]) -> usize {
     |                                    ----- expected `usize` because of return type
...
1058 | /     Limb::BITS.checked_mul(x.len())
1059 | |         .map(|v| v - nlz)
1060 | |         .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
     |
1058 |     Limb::BITS.checked_mul(x.len())
1059 |         .map(|v| v - nlz)
1060 |         .unwrap_or(usize::max_value()).try_into().unwrap()
     |

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1085:23
     |
1085 |     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
     |
1085 |     debug_assert!(n < bits.try_into().unwrap() && n != 0);
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1092:25
     |
1092 |     let lshift = bits - n;
     |                         ^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1092:23
     |
1092 |     let lshift = bits - n;
     |                       ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1134:19
     |
1134 |     let rem = n % bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot mod `usize` by `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1134:17
     |
1134 |     let rem = n % bits;
     |                 ^ no implementation for `usize % u32`
     |
     = help: the trait `Rem<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1135:19
     |
1135 |     let div = n / bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot divide `usize` by `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1135:17
     |
1135 |     let div = n / bits;
     |                 ^ no implementation for `usize / u32`
     |
     = help: the trait `Div<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1191:23
     |
1191 |     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
     |
1191 |     debug_assert!(n < bits.try_into().unwrap());
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1201:25
     |
1201 |     let rshift = bits - n;
     |                         ^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1201:23
     |
1201 |     let rshift = bits - n;
     |                       ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1253:19
     |
1253 |     let rem = n % bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot mod `usize` by `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1253:17
     |
1253 |     let rem = n % bits;
     |                 ^ no implementation for `usize % u32`
     |
     = help: the trait `Rem<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1254:19
     |
1254 |     let div = n / bits;
     |                   ^^^^ expected `usize`, found `u32`

error[E0277]: cannot divide `usize` by `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:1254:17
     |
1254 |     let div = n / bits;
     |                 ^ no implementation for `usize / u32`
     |
     = help: the trait `Div<u32>` is not implemented for `usize`

error[E0308]: mismatched types
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:2065:27
     |
2065 |     let rs = Limb::BITS - s;
     |                           ^ expected `u32`, found `usize`

error[E0277]: cannot subtract `usize` from `u32`
    --> /home/.cargo/registry/src/lexical-core-0.7.4/src/atof/algorithm/math.rs:2065:25
     |
2065 |     let rs = Limb::BITS - s;
     |                         ^ no implementation for `u32 - usize`
     |
     = help: the trait `Sub<usize>` is not implemented for `u32`

Rustup&rustc version on the machine (running lubuntu 20.04) is

rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.53.0 (53cb7b09b 2021-06-17)`

I think this might be related to the issue discussed here:

rust-lang/rust#81654

Thanks!

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

1 participant