Sometimes using Rust is really annoying

⚓ Rust    📅 2025-10-05    👤 surdeus    👁️ 5      

surdeus

So in a recent conversation here I was reminded of an old Rust project in my GitHub and I thought I would check it out again just for fun. fibo_4784969 in Rust

So I cloned it to my new Mac M4 and tried to build it. Sadly out of the box it fails with errors unfathomable to me.

   Compiling num-bigint v0.4.0
error[E0308]: mismatched types
    --> /Users/Michaael/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-0.4.0/src/biguint/convert.rs:70:19
     |
  70 |         .div_ceil(&big_digit::BITS.into())
     |          -------- ^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `&_`
     |          |
     |          arguments to this method are incorrect
     |
     = note:   expected type `u64`
             found reference `&_`
note: method defined here
    --> /Users/Michaael/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/num/mod.rs:1151:5
     |
1151 | /     uint_impl! {
1152 | |         Self = u64,
1153 | |         ActualT = u64,
1154 | |         SignedT = i64,
...    |
1168 | |         bound_condition = "",
1169 | |     }
     | |_____^
     = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
     |
  70 -         .div_ceil(&big_digit::BITS.into())
  70 +         .div_ceil(big_digit::BITS.into())
     |

error[E0308]: mismatched types
    --> /Users/Michaael/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-0.4.0/src/biguint/convert.rs:585:19
     |
 585 |         .div_ceil(&u64::from(bits))
     |          -------- ^^^^^^^^^^^^^^^^ expected `u64`, found `&u64`
     |          |
     |          arguments to this method are incorrect
     |
note: method defined here
    --> /Users/Michaael/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/num/mod.rs:1151:5
     |
1151 | /     uint_impl! {
1152 | |         Self = u64,
1153 | |         ActualT = u64,
1154 | |         SignedT = i64,
...    |
1168 | |         bound_condition = "",
1169 | |     }
     | |_____^
     = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
     |
 585 -         .div_ceil(&u64::from(bits))
 585 +         .div_ceil(u64::from(bits))
     |

error[E0308]: mismatched types
    --> /Users/Michaael/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-0.4.0/src/biguint/convert.rs:613:19
     |
 613 |         .div_ceil(&u64::from(bits))
     |          -------- ^^^^^^^^^^^^^^^^ expected `u64`, found `&u64`
     |          |
     |          arguments to this method are incorrect
     |
note: method defined here
    --> /Users/Michaael/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/num/mod.rs:1151:5
     |
1151 | /     uint_impl! {
1152 | |         Self = u64,
1153 | |         ActualT = u64,
1154 | |         SignedT = i64,
...    |
1168 | |         bound_condition = "",
1169 | |     }
     | |_____^
     = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
     |
 613 -         .div_ceil(&u64::from(bits))
 613 +         .div_ceil(u64::from(bits))
     |

error[E0308]: mismatched types
    --> /Users/Michaael/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-0.4.0/src/biguint.rs:398:54
     |
 398 |                 let root_scale = extra_bits.div_ceil(&n64);
     |                                             -------- ^^^^ expected `u64`, found `&u64`
     |                                             |
     |                                             arguments to this method are incorrect
     |
note: method defined here
    --> /Users/Michaael/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/num/mod.rs:1151:5
     |
1151 | /     uint_impl! {
1152 | |         Self = u64,
1153 | |         ActualT = u64,
1154 | |         SignedT = i64,
...    |
1168 | |         bound_condition = "",
1169 | |     }
     | |_____^
     = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
     |
 398 -                 let root_scale = extra_bits.div_ceil(&n64);
 398 +                 let root_scale = extra_bits.div_ceil(n64);
     |

For more information about this error, try `rustc --explain E0308`.
error: could not compile `num-bigint` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
^

Trying to load the thing into my Zed editor results in rust-analyser hanging up forever with message "Building compile-time-deps"

What to do?

5 posts - 2 participants

Read full topic

🏷️ Rust_feed