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

the trait bound &malachite_nz::integer::Integer: From<&BigInt> is not satisfied #5120

Closed
edreamleo opened this issue Nov 20, 2023 · 3 comments · Fixed by #5135
Closed

the trait bound &malachite_nz::integer::Integer: From<&BigInt> is not satisfied #5120

edreamleo opened this issue Nov 20, 2023 · 3 comments · Fixed by #5135
Labels
C-bug Something isn't working

Comments

@edreamleo
Copy link

edreamleo commented Nov 20, 2023

Summary

I'm a complete newbie to Rust, but there may be a quirp in RustPython's requirements:

With this Cargo.toml:

[package]
name = "ekr-orange"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rustpython = "0.3.0"

And this main.rs:

fn main() {
    println!("main.rs: ekr-orange");
}

I get the following errors:

Errors
error[E0277]: the trait bound `&malachite_nz::integer::Integer: From<&BigInt>` is not satisfied
 --> C:\Users\Dev\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustpython-common-0.3.0\src\int.rs:8:58
  |
8 |     let val: f64 = Rational::from_integers_ref(numerator.into(), denominator.into())
  |                                                          ^^^^ the trait `From<&BigInt>` is not implemented for `&malachite_nz::integer::Integer`
  |
  = help: the following other types implement trait `From<T>`:
            <malachite_nz::integer::Integer as From<bool>>
            <malachite_nz::integer::Integer as From<isize>>
            <malachite_nz::integer::Integer as From<i8>>
            <malachite_nz::integer::Integer as From<i16>>
            <malachite_nz::integer::Integer as From<i32>>
            <malachite_nz::integer::Integer as From<i64>>
            <malachite_nz::integer::Integer as From<i128>>
            <malachite_nz::integer::Integer as From<usize>>
          and 7 others
  = note: required for `&BigInt` to implement `Into<&malachite_nz::integer::Integer>`

error[E0277]: the trait bound `&malachite_nz::integer::Integer: From<&BigInt>` is not satisfied
 --> C:\Users\Dev\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustpython-common-0.3.0\src\int.rs:8:78
  |
8 |     let val: f64 = Rational::from_integers_ref(numerator.into(), denominator.into())
  |                                                                              ^^^^ the trait `From<&BigInt>` is not implemented for `&malachite_nz::integer::Integer`
  |
  = help: the following other types implement trait `From<T>`:
            <malachite_nz::integer::Integer as From<bool>>
            <malachite_nz::integer::Integer as From<isize>>
            <malachite_nz::integer::Integer as From<i8>>
            <malachite_nz::integer::Integer as From<i16>>
            <malachite_nz::integer::Integer as From<i32>>
            <malachite_nz::integer::Integer as From<i64>>
            <malachite_nz::integer::Integer as From<i128>>
            <malachite_nz::integer::Integer as From<usize>>
          and 7 others
  = note: required for `&BigInt` to implement `Into<&malachite_nz::integer::Integer>`

error[E0277]: the trait bound `BigUint: From<malachite_nz::natural::Natural>` is not satisfied
  --> C:\Users\Dev\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustpython-common-0.3.0\src\int.rs:27:46
   |
27 |             BigInt::from_biguint(sign, numer.into()),
   |                                              ^^^^ the trait `From<malachite_nz::natural::Natural>` is not implemented for `BigUint`
   |
   = help: the following other types implement trait `From<T>`:
             <BigUint as From<usize>>
             <BigUint as From<u8>>
             <BigUint as From<u16>>
             <BigUint as From<u32>>
             <BigUint as From<u64>>
             <BigUint as From<u128>>
             <BigUint as From<malachite_nz::natural::Natural>>
   = note: required for `malachite_nz::natural::Natural` to implement `Into<BigUint>`

error[E0277]: the trait bound `BigUint: From<malachite_nz::natural::Natural>` is not satisfied
  --> C:\Users\Dev\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustpython-common-0.3.0\src\int.rs:28:27
   |
28 |             BigUint::from(denom).into(),
   |             ------------- ^^^^^ the trait `From<malachite_nz::natural::Natural>` is not implemented for `BigUint`
   |             |
   |             required by a bound introduced by this call
   |
   = help: the following other types implement trait `From<T>`:
             <BigUint as From<usize>>
             <BigUint as From<u8>>
             <BigUint as From<u16>>
             <BigUint as From<u32>>
             <BigUint as From<u64>>
             <BigUint as From<u128>>
             <BigUint as From<malachite_nz::natural::Natural>>

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

However, all is well if I replace:

rustpython = "0.3.0"

with:

rustpython = { git = "https://github.com/RustPython/RustPython.git" }

Environment

Windows 11
rustc 1.73.0 (cc66ad468 2023-10-03)
rustc 1.74.0 (79e9716c9 2023-11-13)

Summary

This behavior may be expected, but this newbie was surprised.

@edreamleo edreamleo added the C-bug Something isn't working label Nov 20, 2023
@AtomicGamer9523
Copy link

Same error here!

OS:

rustc 1.76.0-nightly (4cb3beec8 2023-11-18)
binary: rustc
commit-hash: 4cb3beec86178baff601529389306a4949b077ce
commit-date: 2023-11-18
host: x86_64-pc-windows-msvc
release: 1.76.0-nightly
LLVM version: 17.0.5

and also:

rustc 1.76.0-nightly (eeff92ad3 2023-12-13)
binary: rustc
commit-hash: eeff92ad32c2627876112ccfe812e19d38494087
commit-date: 2023-12-13
host: x86_64-pc-windows-msvc
release: 1.76.0-nightly
LLVM version: 17.0.5

@youknowone
Copy link
Member

youknowone commented Dec 27, 2023

I am sorry for late response. And thank you for reporrting. I yanked malachite-bigint 0.1.1. It must be fixed.

@edreamleo
Copy link
Author

@youknowone Thanks for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants