Repository: RustPython/RustPython (language: rust)

Issue:
the trait bound `&malachite_nz::integer::Integer: From<&BigInt>` is not satisfied
## Summary

I'm a complete newbie to Rust, but there may be a quirp in RustPython's requirements:

With this `Cargo.toml`:
```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`:

```rust
fn main() {
    println!("main.rs: ekr-orange");
}
```

I get the following errors:

<details><summary>Errors</summary>
<br>

```console
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...
```

</details>

However, all is well if I replace:

```toml
rustpython = "0.3.0"
```
with:
```toml
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.


Discussion / hints:
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
```
I am sorry for late response. And thank you for reporrting. I yanked malachite-bigint 0.1.1. It must be fixed.
@youknowone Thanks for looking into this!

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index c0c59f1552..4edd2d644b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1257,9 +1257,9 @@ dependencies = [
 
 [[package]]
 name = "malachite-bigint"
-version = "0.1.1"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76c3eca3b5df299486144c8423c45c24bdf9e82e2452c8a1eeda547c4d8b5d41"
+checksum = "17703a19c80bbdd0b7919f0f104f3b0597f7de4fc4e90a477c15366a5ba03faa"
 dependencies = [
  "derive_more",
  "malachite",
@@ -1946,7 +1946,7 @@ dependencies = [
 [[package]]
 name = "rustpython-ast"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=52edf4525ec300f2b69670f3991784bbcf140564#52edf4525ec300f2b69670f3991784bbcf140564"
+source = "git+https://github.com/RustPython/Parser.git?rev=29c4728dbedc7e69cc2560b9b34058bbba9b1303#29c4728dbedc7e69cc2560b9b34058bbba9b1303"
 dependencies = [
  "is-macro",
  "malachite-bigint",
@@ -2058,7 +2058,7 @@ dependencies = [
 [[package]]
 name = "rustpython-format"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=52edf4525ec300f2b69670f3991784bbcf140564#52edf4525ec300f2b69670f3991784bbcf140564"
+source = "git+https://github.com/RustPython/Parser.git?rev=29c4728dbedc7e69cc2560b9b34058bbba9b1303#29c4728dbedc7e69cc2560b9b34058bbba9b1303"
 dependencies = [
  "bitflags 2.4.0",
  "itertools 0.11.0",
@@ -2085,7 +2085,7 @@ dependencies = [
 [[package]]
 name = "rustpython-literal"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=52edf4525ec300f2b69670f3991784bbcf140564#52edf4525ec300f2b69670f3991784bbcf140564"
+source = "git+https://github.com/RustPython/Parser.git?rev=29c4728dbedc7e69cc2560b9b34058bbba9b1303#29c4728dbedc7e69cc2560b9b34058bbba9b1303"
 dependencies = [
  "hexf-parse",
  "is-macro",
@@ -2097,7 +2097,7 @@ dependencies = [
 [[package]]
 name = "rustpython-parser"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=52edf4525ec300f2b69670f3991784bbcf140564#52edf4525ec300f2b69670f3991784bbcf140564"
+source = "git+https://github.com/RustPython/Parser.git?rev=29c4728dbedc7e69cc2560b9b34058bbba9b1303#29c4728dbedc7e69cc2560b9b34058bbba9b1303"
 dependencies = [
  "anyhow",
  "is-macro",
@@ -2120,7 +2120,7 @@ dependencies = [
 [[package]]
 name = "rustpython-parser-core"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=52edf4525ec300f2b69670f3991784bbcf140564#52edf4525ec300f2b69670f3991784bbcf140564"
+source = "git+https://github.com/RustPython/Parser.git?rev=29c4728dbedc7e69cc2560b9b34058bbba9b1303#29c4728dbedc7e69cc2560b9b34058bbba9b1303"
 dependencies = [
  "is-macro",
  "memchr",
@@ -2130,7 +2130,7 @@ dependencies = [
 [[package]]
 name = "rustpython-parser-vendored"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=52edf4525ec300f2b69670f3991784bbcf140564#52edf4525ec300f2b69670f3991784bbcf140564"
+source = "git+https://github.com/RustPython/Parser.git?rev=29c4728dbedc7e69cc2560b9b34058bbba9b1303#29c4728dbedc7e69cc2560b9b34058bbba9b1303"
 dependencies = [
  "memchr",
  "once_cell",
diff --git a/Cargo.toml b/Cargo.toml
index 680f090cc4..a91f2ea05f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,11 +29,11 @@ rustpython-pylib = { path = "pylib", version = "0.3.0" }
 rustpython-stdlib = { path = "stdlib", default-features = false, version = "0.3.0" }
 rustpython-doc = { git = "https://github.com/RustPython/__doc__", tag = "0.3.0", version = "0.3.0" }
 
-rustpython-literal = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
-rustpython-parser-core = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
-rustpython-parser = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
-rustpython-ast = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
-rustpython-format = { git = "https://github.com/RustPython/Parser.git", rev = "52edf4525ec300f2b69670f3991784bbcf140564" }
+rustpython-literal = { git = "https://github.com/RustPython/Parser.git", rev = "29c4728dbedc7e69cc2560b9b34058bbba9b1303" }
+rustpython-parser-core = { git = "https://github.com/RustPython/Parser.git", rev = "29c4728dbedc7e69cc2560b9b34058bbba9b1303" }
+rustpython-parser = { git = "https://github.com/RustPython/Parser.git", rev = "29c4728dbedc7e69cc2560b9b34058bbba9b1303" }
+rustpython-ast = { git = "https://github.com/RustPython/Parser.git", rev = "29c4728dbedc7e69cc2560b9b34058bbba9b1303" }
+rustpython-format = { git = "https://github.com/RustPython/Parser.git", rev = "29c4728dbedc7e69cc2560b9b34058bbba9b1303" }
 # rustpython-literal = { path = "../RustPython-parser/literal" }
 # rustpython-parser-core = { path = "../RustPython-parser/core" }
 # rustpython-parser = { path = "../RustPython-parser/parser" }
@@ -59,7 +59,7 @@ is-macro = "0.3.0"
 libc = "0.2.133"
 log = "0.4.16"
 nix = "0.26"
-malachite-bigint = "0.1.1"
+malachite-bigint = "0.2.0"
 malachite-q = "0.4.4"
 malachite-base = "0.4.4"
 num-complex = "0.4.0"


Test patch: