Git Product home page Git Product logo

crate2nix's People

Contributors

acairncross avatar alyssais avatar andir avatar apoelstra avatar balsoft avatar bouk avatar cchalmers avatar cidkidnix avatar dependabot[bot] avatar duxovni avatar ericson2314 avatar flokli avatar fuuzetsu avatar github-actions[bot] avatar jamii avatar jordanisaacs avatar kmicklas avatar kolloch avatar kristoff3r avatar lblasc avatar lenianiva avatar lovesegfault avatar marius851000 avatar nagisa avatar pacak avatar pandaman64 avatar steveej avatar symphorien avatar tilpner avatar tmvector avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crate2nix's Issues

anyhow crate broken since 0.1.13

First of all, huge thanks for this. I absolutely love the project and am starting to use it more and more for my projects!

The anyhow crate hasn't been able to compile since 0.1.13. This commit seems to be problematic for crate2nix as it somehow activates the backtrace flag on stable rust and all, when it probably shouldn't.

Comparison to `carnix`

carnix seems to be the standard tool for transforming rust packages to nix derivations. What’s the differences in features?

I would vastly prefer crate2nix, simply because carnix has no bit of documentation, no changelog, and does not integrate with nixpkgs best practices (e.g. they decided to use Pijul instead of git(hub) like the rest of the ecosystem).

Examples oh what I’m looking for are:

  • how well does crate2nix support crate features, compared to carnix
  • status of overriding packages

Existing features / missing features should always compare to carnix.

Override compiler version

How can I override, which rustc version or branch (stable/beta/nightly) to use?

Also it would be cool, if crate2nix would check for rust-toolchain files which are used by rustup to pin a specific compiler version and or branch for a repository.

Question: use cases for crate2nix generated default.nix

A general question...

I'm curious what the use cases are for the default.nix generated by crate2nix. I can see a case for using Nix and its cacheing for building during development, and locally. However, is it useful to submit the generated default.nix to Nixpkgs? For one thing, the generated file is very large, and for another, since rust is statically linked, the project can be built at once with buildRustPackage and cached as one package, once it's been cached, there should be no penalty for doing a full build with Cargo, so I don't see the advantage, and if there is, i'm curious what it is.

I'm asking since I'm thinking of submitting a package to Nixpkgs, and i'm not sure whether to add the crate2nix generated default.nix or just use the single buildRustPackage, which the majority of Rust packages on Nixpkgs use. It even seems to be the case that a rather small minority of Rust packages on Nixpkgs use carnix.

Relative path to source not a valid nix path

When generating the Cargo.nix into a child directory (e.g. nix/) then the relative path to the source code is not a valid nix path.

Example:

crate2nix generate -o nix/Cargo.nix

Generated expresssion:

{
# …
        edition = "2018";
        src = (builtins.filterSource sourceFilter ..); # .. should be ../.
# …
}

The path should not be .. but rather ../..

Test prefetching

We do not have tests yet that check if the right stuff is prefetched and correctly saved.

The default pkgs is <nixpkgs>, not <nixos>

You should change the pkgs attribute to be pkgs ? import <nixpkgs> {}, which is the right way to import nixpkgs.

<nixos> is just a reference to <nixpkgs/nixos> usually, and is NixOS-specific.

Remove unnecessary metadata.

Since the file is completely defined by the Cargo.toml lock file, we don’t need to add any metadata and should leave all inspection to cargo.

Compilation issues with `num`

First time using crate2nix, so user error is likely.

nix /tmp > crate2nix -V
crate2nix 0.4.0
nix /tmp > rustc -V
rustc 1.32.0
nix /tmp > cargo -V
cargo 1.32.0
nix /tmp > cargo new --bin numtest
     Created binary (application) `numtest` package
nix /tmp > cd numtest
nix /tmp/numtest > echo 'num = "0.2"' >> Cargo.toml
nix /tmp/numtest > crate2nix generate -n '<nixpkgs>'
Prefetching    1/8: https://crates.io/api/v1/crates/autocfg/0.1.5/download
Prefetching    2/8: https://crates.io/api/v1/crates/num/0.2.0/download
Prefetching    3/8: https://crates.io/api/v1/crates/num-bigint/0.2.2/download
Prefetching    4/8: https://crates.io/api/v1/crates/num-complex/0.2.3/download
Prefetching    5/8: https://crates.io/api/v1/crates/num-integer/0.1.41/download
Prefetching    6/8: https://crates.io/api/v1/crates/num-iter/0.1.39/download
Prefetching    7/8: https://crates.io/api/v1/crates/num-rational/0.2.2/download
Prefetching    8/8: https://crates.io/api/v1/crates/num-traits/0.2.8/download
Wrote hashes to ./crate-hashes.json.
Generated ./default.nix successfully.

nix /tmp/numtest > NIX_PATH=nixpkgs=channel:nixos-unstable nix-build --no-out-link -A rootCrate.build
these derivations will be built:
  /nix/store/z9nlbzmxsz6smr6l1yf1x1civh1x7ahl-rust_num-bigint-0.2.2.drv
  /nix/store/61bsd5gi3k53mc7sk3s966iyydk3p7rp-rust_num-rational-0.2.2.drv
  /nix/store/dpk4r1sp782hnj0mxxgk6yg7vy392cx3-rust_num-0.2.0.drv
  /nix/store/0sjm90mbycyx355l5qm993inll42swd8-rust_numtest-0.1.0.drv
building '/nix/store/z9nlbzmxsz6smr6l1yf1x1civh1x7ahl-rust_num-bigint-0.2.2.drv'...
unpacking sources
unpacking source archive /nix/store/dbbddfhjvlwm1hhllmlb42ilamaalqbd-num-bigint-0.2.2.tar.gz
source root is num-bigint-0.2.2.tar.gz
patching sources
configuring
Building build.rs (num-bigint)
Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=7 --edition 2015 --out-dir target/build/num-bigint --emit=dep-info,link -L dependency=target/buildDeps --cap-lints allow --color always
building
Building src/lib.rs (num-bigint)
Running rustc --crate-name num_bigint src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=7 --edition 2015 -C metadata=5267052fbf -C extra-filename=-5267052fbf --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern num_integer=/nix/store/1cfg1aw253ks1l0xxs1nch5y88v297a4-rust_num-integer-0.1.41/lib/libnum_integer-92d5248289.rlib --extern num_traits=/nix/store/sfjpdhzv45crw4hd9ya0wdg949wkjhyz-rust_num-traits-0.2.8/lib/libnum_traits-bc00277194.rlib --cap-lints allow -L /build/num-bigint-0.2.2.tar.gz/target/build/num-bigint.out --cfg has_i128 --color always
error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
  --> src/lib.rs:91:5
   |
91 | use std::error::Error;
   |     ^^^ maybe a missing `extern crate std;`?
...
error: aborting due to 497 previous errors

Some errors occurred: E0405, E0412, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0405`.
builder for '/nix/store/z9nlbzmxsz6smr6l1yf1x1civh1x7ahl-rust_num-bigint-0.2.2.drv' failed with exit code 1
cannot build derivation '/nix/store/0sjm90mbycyx355l5qm993inll42swd8-rust_numtest-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/0sjm90mbycyx355l5qm993inll42swd8-rust_numtest-0.1.0.drv' failed
Full error

these derivations will be built:
  /nix/store/z9nlbzmxsz6smr6l1yf1x1civh1x7ahl-rust_num-bigint-0.2.2.drv
  /nix/store/61bsd5gi3k53mc7sk3s966iyydk3p7rp-rust_num-rational-0.2.2.drv
  /nix/store/dpk4r1sp782hnj0mxxgk6yg7vy392cx3-rust_num-0.2.0.drv
  /nix/store/0sjm90mbycyx355l5qm993inll42swd8-rust_numtest-0.1.0.drv
building '/nix/store/z9nlbzmxsz6smr6l1yf1x1civh1x7ahl-rust_num-bigint-0.2.2.drv'...
unpacking sources
unpacking source archive /nix/store/dbbddfhjvlwm1hhllmlb42ilamaalqbd-num-bigint-0.2.2.tar.gz
source root is num-bigint-0.2.2.tar.gz
patching sources
configuring
Building build.rs (num-bigint)
Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=7 --edition 2015 --out-dir target/build/num-bigint --emit=dep-info,link -L dependency=target/buildDeps --cap-lints allow --color always
building
Building src/lib.rs (num-bigint)
Running rustc --crate-name num_bigint src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=7 --edition 2015 -C metadata=5267052fbf -C extra-filename=-5267052fbf --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern num_integer=/nix/store/1cfg1aw253ks1l0xxs1nch5y88v297a4-rust_num-integer-0.1.41/lib/libnum_integer-92d5248289.rlib --extern num_traits=/nix/store/sfjpdhzv45crw4hd9ya0wdg949wkjhyz-rust_num-traits-0.2.8/lib/libnum_traits-bc00277194.rlib --cap-lints allow -L /build/num-bigint-0.2.2.tar.gz/target/build/num-bigint.out --cfg has_i128 --color always
error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
  --> src/lib.rs:91:5
   |
91 | use std::error::Error;
   |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/bigint.rs:2:5
  |
2 | use std::ascii::AsciiExt;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/bigint.rs:3:5
  |
3 | use std::cmp::Ordering::{self, Equal, Greater, Less};
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/bigint.rs:4:5
  |
4 | use std::default::Default;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/lib.rs:92:5
   |
92 | use std::fmt;
   |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/bigint.rs:6:5
  |
6 | use std::iter::{Product, Sum};
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/bigint.rs:5:5
  |
5 | use std::fmt;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/bigint.rs:8:5
  |
8 | use std::ops::{
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/bigint.rs:7:5
  |
7 | use std::mem;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
  --> src/bigint.rs:12:5
   |
12 | use std::str::{self, FromStr};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/bigint.rs:12:5
   |
12 | use std::str::{self, FromStr};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/bigint.rs:14:5
   |
14 | use std::{i128, u128};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/biguint.rs:2:5
  |
2 | use std::ascii::AsciiExt;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/biguint.rs:3:5
  |
3 | use std::borrow::Cow;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/bigint.rs:15:5
   |
15 | use std::{i64, u64};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/biguint.rs:5:5
  |
5 | use std::cmp::Ordering::{self, Equal, Greater, Less};
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/biguint.rs:6:5
  |
6 | use std::default::Default;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/biguint.rs:4:5
  |
4 | use std::cmp;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/biguint.rs:8:5
  |
8 | use std::iter::{Product, Sum};
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/biguint.rs:7:5
  |
7 | use std::fmt;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
  --> src/biguint.rs:10:5
   |
10 | use std::ops::{
   |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/biguint.rs:9:5
  |
9 | use std::mem;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
  --> src/biguint.rs:14:5
   |
14 | use std::str::{self, FromStr};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/biguint.rs:14:5
   |
14 | use std::str::{self, FromStr};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/biguint.rs:15:5
   |
15 | use std::{f32, f64};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/algorithms.rs:1:5
  |
1 | use std::borrow::Cow;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
  --> src/biguint.rs:16:5
   |
16 | use std::{u64, u8};
   |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/algorithms.rs:3:5
  |
3 | use std::cmp::Ordering::{self, Equal, Greater, Less};
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: maybe a missing `extern crate std;`?
 --> src/algorithms.rs:4:5
  |
4 | use std::iter::repeat;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/algorithms.rs:2:5
  |
2 | use std::cmp;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0432]: unresolved import `std`
 --> src/algorithms.rs:5:5
  |
5 | use std::mem;
  |     ^^^ maybe a missing `extern crate std;`?

error[E0433]: failed to resolve: use of undeclared type or module `BitAnd`
   --> src/bigint.rs:325:29
    |
325 | forward_val_val_binop!(impl BitAnd for BigInt, bitand);
    |                             ^^^^^^ use of undeclared type or module `BitAnd`

error[E0433]: failed to resolve: use of undeclared type or module `BitAnd`
   --> src/bigint.rs:326:29
    |
326 | forward_ref_val_binop!(impl BitAnd for BigInt, bitand);
    |                             ^^^^^^ use of undeclared type or module `BitAnd`

error[E0433]: failed to resolve: use of undeclared type or module `BitOr`
   --> src/bigint.rs:460:29
    |
460 | forward_val_val_binop!(impl BitOr for BigInt, bitor);
    |                             ^^^^^ use of undeclared type or module `BitOr`

error[E0433]: failed to resolve: use of undeclared type or module `BitOr`
   --> src/bigint.rs:461:29
    |
461 | forward_ref_val_binop!(impl BitOr for BigInt, bitor);
    |                             ^^^^^ use of undeclared type or module `BitOr`

error[E0433]: failed to resolve: use of undeclared type or module `BitXor`
   --> src/bigint.rs:612:48
    |
612 | forward_all_binop_to_val_ref_commutative!(impl BitXor for BigInt, bitxor);
    |                                                ^^^^^^ use of undeclared type or module `BitXor`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/bigint.rs:964:27
    |
964 | promote_all_scalars!(impl Add for BigInt, add);
    |                           ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/bigint.rs:966:55
    |
966 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u32> for BigInt, add);
    |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/bigint.rs:967:55
    |
967 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u64> for BigInt, add);
    |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/bigint.rs:969:55
    |
969 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u128> for BigInt, add);
    |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
    --> src/bigint.rs:1045:55
     |
1045 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<i32> for BigInt, add);
     |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
    --> src/bigint.rs:1046:55
     |
1046 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<i64> for BigInt, add);
     |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
    --> src/bigint.rs:1048:55
     |
1048 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<i128> for BigInt, add);
     |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1193:27
     |
1193 | promote_all_scalars!(impl Sub for BigInt, sub);
     |                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1195:43
     |
1195 | forward_all_scalar_binop_to_val_val!(impl Sub<u32> for BigInt, sub);
     |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1196:43
     |
1196 | forward_all_scalar_binop_to_val_val!(impl Sub<u64> for BigInt, sub);
     |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1198:43
     |
1198 | forward_all_scalar_binop_to_val_val!(impl Sub<u128> for BigInt, sub);
     |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1301:43
     |
1301 | forward_all_scalar_binop_to_val_val!(impl Sub<i32> for BigInt, sub);
     |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1302:43
     |
1302 | forward_all_scalar_binop_to_val_val!(impl Sub<i64> for BigInt, sub);
     |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
    --> src/bigint.rs:1304:43
     |
1304 | forward_all_scalar_binop_to_val_val!(impl Sub<i128> for BigInt, sub);
     |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1416:36
     |
1416 | forward_all_binop_to_ref_ref!(impl Mul for BigInt, mul);
     |                                    ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1435:27
     |
1435 | promote_all_scalars!(impl Mul for BigInt, mul);
     |                           ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1437:55
     |
1437 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u32> for BigInt, mul);
     |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1438:55
     |
1438 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u64> for BigInt, mul);
     |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1440:55
     |
1440 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u128> for BigInt, mul);
     |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1499:55
     |
1499 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<i32> for BigInt, mul);
     |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1500:55
     |
1500 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<i64> for BigInt, mul);
     |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
    --> src/bigint.rs:1502:55
     |
1502 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<i128> for BigInt, mul);
     |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1579:36
     |
1579 | forward_all_binop_to_ref_ref!(impl Div for BigInt, div);
     |                                    ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1599:27
     |
1599 | promote_all_scalars!(impl Div for BigInt, div);
     |                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1601:43
     |
1601 | forward_all_scalar_binop_to_val_val!(impl Div<u32> for BigInt, div);
     |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1602:43
     |
1602 | forward_all_scalar_binop_to_val_val!(impl Div<u64> for BigInt, div);
     |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1604:43
     |
1604 | forward_all_scalar_binop_to_val_val!(impl Div<u128> for BigInt, div);
     |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1693:43
     |
1693 | forward_all_scalar_binop_to_val_val!(impl Div<i32> for BigInt, div);
     |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1694:43
     |
1694 | forward_all_scalar_binop_to_val_val!(impl Div<i64> for BigInt, div);
     |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
    --> src/bigint.rs:1696:43
     |
1696 | forward_all_scalar_binop_to_val_val!(impl Div<i128> for BigInt, div);
     |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1815:36
     |
1815 | forward_all_binop_to_ref_ref!(impl Rem for BigInt, rem);
     |                                    ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1835:27
     |
1835 | promote_all_scalars!(impl Rem for BigInt, rem);
     |                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1837:43
     |
1837 | forward_all_scalar_binop_to_val_val!(impl Rem<u32> for BigInt, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1838:43
     |
1838 | forward_all_scalar_binop_to_val_val!(impl Rem<u64> for BigInt, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1840:43
     |
1840 | forward_all_scalar_binop_to_val_val!(impl Rem<u128> for BigInt, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1929:43
     |
1929 | forward_all_scalar_binop_to_val_val!(impl Rem<i32> for BigInt, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1930:43
     |
1930 | forward_all_scalar_binop_to_val_val!(impl Rem<i64> for BigInt, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/bigint.rs:1932:43
     |
1932 | forward_all_scalar_binop_to_val_val!(impl Rem<i128> for BigInt, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/bigint.rs:2630:30
     |
2630 |             let mut digits = Vec::from(digits);
     |                              ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/bigint.rs:2651:30
     |
2651 |             let mut digits = Vec::from(digits);
     |                              ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `String`
    --> src/bigint.rs:2823:18
     |
2823 |         unsafe { String::from_utf8_unchecked(v) }
     |                  ^^^^^^ use of undeclared type or module `String`

error: cannot find macro `vec!` in this scope
   --> src/biguint.rs:429:22
    |
429 |         BigUint::new(vec![1])
    |                      ^^^

error: cannot find macro `vec!` in this scope
    --> src/biguint.rs:1788:9
     |
1788 |         vec![0]
     |         ^^^

error: cannot find macro `vec!` in this scope
    --> src/biguint.rs:2034:13
     |
2034 |             vec![0]
     |             ^^^

error: cannot find macro `vec!` in this scope
   --> src/algorithms.rs:316:37
    |
316 |         let mut p = BigUint { data: vec![0; len] };
    |                                     ^^^

error: cannot find macro `vec!` in this scope
   --> src/algorithms.rs:481:36
    |
481 |     let mut prod = BigUint { data: vec![0; len] };
    |                                    ^^^

error: cannot find macro `vec!` in this scope
   --> src/algorithms.rs:544:15
    |
544 |         data: vec![0; q_len],
    |               ^^^

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> src/algorithms.rs:552:15
    |
552 |         data: Vec::with_capacity(2),
    |               ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> src/algorithms.rs:616:28
    |
616 |             let mut data = Vec::with_capacity(len);
    |                            ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Cow`
   --> src/algorithms.rs:646:9
    |
646 |         Cow::Borrowed(n) => n.data[n_unit..].to_vec(),
    |         ^^^ use of undeclared type or module `Cow`

error[E0433]: failed to resolve: use of undeclared type or module `Cow`
   --> src/algorithms.rs:647:9
    |
647 |         Cow::Owned(mut n) => {
    |         ^^^ use of undeclared type or module `Cow`

error: cannot find macro `vec!` in this scope
   --> src/monty.rs:109:17
    |
109 |     let mut v = vec![0; modulus.data.len()];
    |                 ^^^

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> src/biguint.rs:151:20
    |
151 |     let mut data = Vec::with_capacity(big_digits);
    |                    ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> src/biguint.rs:187:20
    |
187 |     let mut data = Vec::with_capacity(big_digits as usize);
    |                    ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> src/biguint.rs:242:21
    |
242 |         let mut v = Vec::with_capacity(s.len());
    |                     ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `BitAnd`
   --> src/biguint.rs:274:29
    |
274 | forward_val_val_binop!(impl BitAnd for BigUint, bitand);
    |                             ^^^^^^ use of undeclared type or module `BitAnd`

error[E0433]: failed to resolve: use of undeclared type or module `BitAnd`
   --> src/biguint.rs:275:29
    |
275 | forward_ref_val_binop!(impl BitAnd for BigUint, bitand);
    |                             ^^^^^^ use of undeclared type or module `BitAnd`

error[E0433]: failed to resolve: use of undeclared type or module `BitOr`
   --> src/biguint.rs:315:48
    |
315 | forward_all_binop_to_val_ref_commutative!(impl BitOr for BigUint, bitor);
    |                                                ^^^^^ use of undeclared type or module `BitOr`

error[E0433]: failed to resolve: use of undeclared type or module `BitXor`
   --> src/biguint.rs:339:48
    |
339 | forward_all_binop_to_val_ref_commutative!(impl BitXor for BigUint, bitxor);
    |                                                ^^^^^^ use of undeclared type or module `BitXor`

error[E0433]: failed to resolve: use of undeclared type or module `Cow`
   --> src/biguint.rs:369:21
    |
369 |         biguint_shl(Cow::Owned(self), rhs)
    |                     ^^^ use of undeclared type or module `Cow`

error[E0433]: failed to resolve: use of undeclared type or module `Cow`
   --> src/biguint.rs:377:21
    |
377 |         biguint_shl(Cow::Borrowed(self), rhs)
    |                     ^^^ use of undeclared type or module `Cow`

error[E0433]: failed to resolve: use of undeclared type or module `Cow`
   --> src/biguint.rs:394:21
    |
394 |         biguint_shr(Cow::Owned(self), rhs)
    |                     ^^^ use of undeclared type or module `Cow`

error[E0433]: failed to resolve: use of undeclared type or module `Cow`
   --> src/biguint.rs:402:21
    |
402 |         biguint_shr(Cow::Borrowed(self), rhs)
    |                     ^^^ use of undeclared type or module `Cow`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> src/biguint.rs:417:22
    |
417 |         BigUint::new(Vec::new())
    |                      ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/biguint.rs:492:48
    |
492 | forward_all_binop_to_val_ref_commutative!(impl Add for BigUint, add);
    |                                                ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/biguint.rs:520:32
    |
520 | promote_unsigned_scalars!(impl Add for BigUint, add);
    |                                ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/biguint.rs:522:55
    |
522 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u32> for BigUint, add);
    |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/biguint.rs:523:55
    |
523 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u64> for BigUint, add);
    |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Add`
   --> src/biguint.rs:525:55
    |
525 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u128> for BigUint, add);
    |                                                       ^^^ use of undeclared type or module `Add`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
   --> src/biguint.rs:621:29
    |
621 | forward_val_val_binop!(impl Sub for BigUint, sub);
    |                             ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
   --> src/biguint.rs:622:29
    |
622 | forward_ref_ref_binop!(impl Sub for BigUint, sub);
    |                             ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
   --> src/biguint.rs:658:32
    |
658 | promote_unsigned_scalars!(impl Sub for BigUint, sub);
    |                                ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
   --> src/biguint.rs:660:43
    |
660 | forward_all_scalar_binop_to_val_val!(impl Sub<u32> for BigUint, sub);
    |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
   --> src/biguint.rs:661:43
    |
661 | forward_all_scalar_binop_to_val_val!(impl Sub<u64> for BigUint, sub);
    |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Sub`
   --> src/biguint.rs:663:43
    |
663 | forward_all_scalar_binop_to_val_val!(impl Sub<u128> for BigUint, sub);
    |                                           ^^^ use of undeclared type or module `Sub`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
   --> src/biguint.rs:764:36
    |
764 | forward_all_binop_to_ref_ref!(impl Mul for BigUint, mul);
    |                                    ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
   --> src/biguint.rs:782:32
    |
782 | promote_unsigned_scalars!(impl Mul for BigUint, mul);
    |                                ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
   --> src/biguint.rs:784:55
    |
784 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u32> for BigUint, mul);
    |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
   --> src/biguint.rs:785:55
    |
785 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u64> for BigUint, mul);
    |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Mul`
   --> src/biguint.rs:787:55
    |
787 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u128> for BigUint, mul);
    |                                                       ^^^ use of undeclared type or module `Mul`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
   --> src/biguint.rs:860:36
    |
860 | forward_all_binop_to_ref_ref!(impl Div for BigUint, div);
    |                                    ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
   --> src/biguint.rs:879:32
    |
879 | promote_unsigned_scalars!(impl Div for BigUint, div);
    |                                ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
   --> src/biguint.rs:881:43
    |
881 | forward_all_scalar_binop_to_val_val!(impl Div<u32> for BigUint, div);
    |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
   --> src/biguint.rs:882:43
    |
882 | forward_all_scalar_binop_to_val_val!(impl Div<u64> for BigUint, div);
    |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Div`
   --> src/biguint.rs:884:43
    |
884 | forward_all_scalar_binop_to_val_val!(impl Div<u128> for BigUint, div);
    |                                           ^^^ use of undeclared type or module `Div`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
   --> src/biguint.rs:984:36
    |
984 | forward_all_binop_to_ref_ref!(impl Rem for BigUint, rem);
    |                                    ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/biguint.rs:1003:32
     |
1003 | promote_unsigned_scalars!(impl Rem for BigUint, rem);
     |                                ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/biguint.rs:1005:43
     |
1005 | forward_all_scalar_binop_to_val_val!(impl Rem<u32> for BigUint, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/biguint.rs:1006:43
     |
1006 | forward_all_scalar_binop_to_val_val!(impl Rem<u64> for BigUint, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Rem`
    --> src/biguint.rs:1008:43
     |
1008 | forward_all_scalar_binop_to_val_val!(impl Rem<u128> for BigUint, rem);
     |                                           ^^^ use of undeclared type or module `Rem`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/biguint.rs:1698:19
     |
1698 |     let mut res = Vec::with_capacity(digits);
     |                   ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/biguint.rs:1722:19
     |
1722 |     let mut res = Vec::with_capacity(digits);
     |                   ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/biguint.rs:1762:19
     |
1762 |     let mut res = Vec::with_capacity(radix_digits as usize);
     |                   ^^^ use of undeclared type or module `Vec`

error: cannot find macro `vec!` in this scope
    --> src/biguint.rs:1810:16
     |
1810 |         return vec![b'0'];
     |                ^^^

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/biguint.rs:1947:25
     |
1947 |             let mut v = Vec::from(buf);
     |                         ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `Vec`
    --> src/biguint.rs:1996:25
     |
1996 |             let mut v = Vec::from(buf);
     |                         ^^^ use of undeclared type or module `Vec`

error[E0433]: failed to resolve: use of undeclared type or module `String`
    --> src/biguint.rs:2055:18
     |
2055 |         unsafe { String::from_utf8_unchecked(v) }
     |                  ^^^^^^ use of undeclared type or module `String`

error[E0405]: cannot find trait `Neg` in this scope
  --> src/bigint.rs:45:6
   |
45 | impl Neg for Sign {
   |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
2  | use core::ops::Neg;
   |

error[E0405]: cannot find trait `Mul` in this scope
  --> src/bigint.rs:59:6
   |
59 | impl Mul<Sign> for Sign {
   |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
2  | use core::ops::Mul;
   |

error[E0425]: cannot find value `Equal` in this scope
   --> src/bigint.rs:136:28
    |
136 |         self.cmp(other) == Equal
    |                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::cmp::Ordering::Equal;
    |

error[E0412]: cannot find type `Ordering` in this scope
   --> src/bigint.rs:144:53
    |
144 |     fn partial_cmp(&self, other: &BigInt) -> Option<Ordering> {
    |                                                     ^^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
2   | use core::cmp::Ordering;
    |
2   | use core::sync::atomic::Ordering;
    |

error[E0412]: cannot find type `Ordering` in this scope
   --> src/bigint.rs:151:38
    |
151 |     fn cmp(&self, other: &BigInt) -> Ordering {
    |                                      ^^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
2   | use core::cmp::Ordering;
    |
2   | use core::sync::atomic::Ordering;
    |

error[E0425]: cannot find value `Equal` in this scope
   --> src/bigint.rs:153:20
    |
153 |         if scmp != Equal {
    |                    ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::cmp::Ordering::Equal;
    |

error[E0425]: cannot find value `Equal` in this scope
   --> src/bigint.rs:158:23
    |
158 |             NoSign => Equal,
    |                       ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::cmp::Ordering::Equal;
    |

error[E0405]: cannot find trait `Not` in this scope
   --> src/bigint.rs:232:6
    |
232 | impl Not for BigInt {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Not;
    |

error[E0405]: cannot find trait `Not` in this scope
   --> src/bigint.rs:250:10
    |
250 | impl<'a> Not for &'a BigInt {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Not;
    |

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:264:27
    |
264 | fn bitand_pos_neg(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                           ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:276:27
    |
276 | fn bitand_neg_pos(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                           ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:295:27
    |
295 | fn bitand_neg_neg(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                           ^^^ not found in this scope

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/bigint.rs:325:29
    |
325 | forward_val_val_binop!(impl BitAnd for BigInt, bitand);
    |                             ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/bigint.rs:326:29
    |
326 | forward_ref_val_binop!(impl BitAnd for BigInt, bitand);
    |                             ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/bigint.rs:330:14
    |
330 | impl<'a, 'b> BitAnd<&'b BigInt> for &'a BigInt {
    |              ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/bigint.rs:352:10
    |
352 | impl<'a> BitAnd<&'a BigInt> for BigInt {
    |          ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAndAssign` in this scope
   --> src/bigint.rs:362:26
    |
362 | forward_val_assign!(impl BitAndAssign for BigInt, bitand_assign);
    |                          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAndAssign;
    |

error[E0405]: cannot find trait `BitAndAssign` in this scope
   --> src/bigint.rs:364:10
    |
364 | impl<'a> BitAndAssign<&'a BigInt> for BigInt {
    |          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAndAssign;
    |

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:395:26
    |
395 | fn bitor_pos_neg(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                          ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:420:26
    |
420 | fn bitor_neg_pos(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                          ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:442:26
    |
442 | fn bitor_neg_neg(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                          ^^^ not found in this scope

error[E0405]: cannot find trait `BitOr` in this scope
   --> src/bigint.rs:460:29
    |
460 | forward_val_val_binop!(impl BitOr for BigInt, bitor);
    |                             ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOr;
    |

error[E0405]: cannot find trait `BitOr` in this scope
   --> src/bigint.rs:461:29
    |
461 | forward_ref_val_binop!(impl BitOr for BigInt, bitor);
    |                             ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOr;
    |

error[E0405]: cannot find trait `BitOr` in this scope
   --> src/bigint.rs:465:14
    |
465 | impl<'a, 'b> BitOr<&'b BigInt> for &'a BigInt {
    |              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOr;
    |

error[E0405]: cannot find trait `BitOr` in this scope
   --> src/bigint.rs:488:10
    |
488 | impl<'a> BitOr<&'a BigInt> for BigInt {
    |          ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOr;
    |

error[E0405]: cannot find trait `BitOrAssign` in this scope
   --> src/bigint.rs:498:26
    |
498 | forward_val_assign!(impl BitOrAssign for BigInt, bitor_assign);
    |                          ^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOrAssign;
    |

error[E0405]: cannot find trait `BitOrAssign` in this scope
   --> src/bigint.rs:500:10
    |
500 | impl<'a> BitOrAssign<&'a BigInt> for BigInt {
    |          ^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOrAssign;
    |

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:526:27
    |
526 | fn bitxor_pos_neg(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                           ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:555:27
    |
555 | fn bitxor_neg_pos(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                           ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
   --> src/bigint.rs:584:27
    |
584 | fn bitxor_neg_neg(a: &mut Vec<BigDigit>, b: &[BigDigit]) {
    |                           ^^^ not found in this scope

error[E0405]: cannot find trait `BitXor` in this scope
   --> src/bigint.rs:612:48
    |
612 | forward_all_binop_to_val_ref_commutative!(impl BitXor for BigInt, bitxor);
    |                                                ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXor;
    |

error[E0405]: cannot find trait `BitXor` in this scope
   --> src/bigint.rs:614:10
    |
614 | impl<'a> BitXor<&'a BigInt> for BigInt {
    |          ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXor;
    |

error[E0405]: cannot find trait `BitXorAssign` in this scope
   --> src/bigint.rs:624:26
    |
624 | forward_val_assign!(impl BitXorAssign for BigInt, bitxor_assign);
    |                          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXorAssign;
    |

error[E0405]: cannot find trait `BitXorAssign` in this scope
   --> src/bigint.rs:626:10
    |
626 | impl<'a> BitXorAssign<&'a BigInt> for BigInt {
    |          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXorAssign;
    |

error[E0405]: cannot find trait `FromStr` in this scope
   --> src/bigint.rs:655:6
    |
655 | impl FromStr for BigInt {
    |      ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::str::FromStr;
    |

error[E0405]: cannot find trait `Shl` in this scope
   --> src/bigint.rs:684:6
    |
684 | impl Shl<usize> for BigInt {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shl;
    |

error[E0405]: cannot find trait `Shl` in this scope
   --> src/bigint.rs:694:10
    |
694 | impl<'a> Shl<usize> for &'a BigInt {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shl;
    |

error[E0405]: cannot find trait `ShlAssign` in this scope
   --> src/bigint.rs:703:6
    |
703 | impl ShlAssign<usize> for BigInt {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::ShlAssign;
    |

error[E0405]: cannot find trait `Shr` in this scope
   --> src/bigint.rs:719:6
    |
719 | impl Shr<usize> for BigInt {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shr;
    |

error[E0405]: cannot find trait `Shr` in this scope
   --> src/bigint.rs:729:10
    |
729 | impl<'a> Shr<usize> for &'a BigInt {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shr;
    |

error[E0405]: cannot find trait `ShrAssign` in this scope
   --> src/bigint.rs:740:6
    |
740 | impl ShrAssign<usize> for BigInt {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::ShrAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:912:14
    |
912 | impl<'a, 'b> Add<&'b BigInt> for &'a BigInt {
    |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:928:10
    |
928 | impl<'a> Add<BigInt> for &'a BigInt {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:937:10
    |
937 | impl<'a> Add<&'a BigInt> for BigInt {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:946:6
    |
946 | impl Add<BigInt> for BigInt {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/bigint.rs:955:10
    |
955 | impl<'a> AddAssign<&'a BigInt> for BigInt {
    |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/bigint.rs:962:26
    |
962 | forward_val_assign!(impl AddAssign for BigInt, add_assign);
    |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:964:27
    |
964 | promote_all_scalars!(impl Add for BigInt, add);
    |                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/bigint.rs:965:34
    |
965 | promote_all_scalars_assign!(impl AddAssign for BigInt, add_assign);
    |                                  ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:966:55
    |
966 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u32> for BigInt, add);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:967:55
    |
967 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u64> for BigInt, add);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:969:55
    |
969 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u128> for BigInt, add);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:971:6
    |
971 | impl Add<u32> for BigInt {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/bigint.rs:987:6
    |
987 | impl AddAssign<u32> for BigInt {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/bigint.rs:995:6
    |
995 | impl Add<u64> for BigInt {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
    --> src/bigint.rs:1011:6
     |
1011 | impl AddAssign<u64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::AddAssign;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1020:6
     |
1020 | impl Add<u128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `AddAssign` in this scope
    --> src/bigint.rs:1037:6
     |
1037 | impl AddAssign<u128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::AddAssign;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1045:55
     |
1045 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<i32> for BigInt, add);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1046:55
     |
1046 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<i64> for BigInt, add);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1048:55
     |
1048 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<i128> for BigInt, add);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1050:6
     |
1050 | impl Add<i32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `AddAssign` in this scope
    --> src/bigint.rs:1062:6
     |
1062 | impl AddAssign<i32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::AddAssign;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1073:6
     |
1073 | impl Add<i64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `AddAssign` in this scope
    --> src/bigint.rs:1085:6
     |
1085 | impl AddAssign<i64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::AddAssign;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/bigint.rs:1097:6
     |
1097 | impl Add<i128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `AddAssign` in this scope
    --> src/bigint.rs:1110:6
     |
1110 | impl AddAssign<i128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::AddAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1141:14
     |
1141 | impl<'a, 'b> Sub<&'b BigInt> for &'a BigInt {
     |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1157:10
     |
1157 | impl<'a> Sub<BigInt> for &'a BigInt {
     |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1166:10
     |
1166 | impl<'a> Sub<&'a BigInt> for BigInt {
     |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1175:6
     |
1175 | impl Sub<BigInt> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1184:10
     |
1184 | impl<'a> SubAssign<&'a BigInt> for BigInt {
     |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1191:26
     |
1191 | forward_val_assign!(impl SubAssign for BigInt, sub_assign);
     |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1193:27
     |
1193 | promote_all_scalars!(impl Sub for BigInt, sub);
     |                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1194:34
     |
1194 | promote_all_scalars_assign!(impl SubAssign for BigInt, sub_assign);
     |                                  ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1195:43
     |
1195 | forward_all_scalar_binop_to_val_val!(impl Sub<u32> for BigInt, sub);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1196:43
     |
1196 | forward_all_scalar_binop_to_val_val!(impl Sub<u64> for BigInt, sub);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1198:43
     |
1198 | forward_all_scalar_binop_to_val_val!(impl Sub<u128> for BigInt, sub);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1200:6
     |
1200 | impl Sub<u32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1216:6
     |
1216 | impl SubAssign<u32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1224:6
     |
1224 | impl Sub<BigInt> for u32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1233:6
     |
1233 | impl Sub<BigInt> for u64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1242:6
     |
1242 | impl Sub<BigInt> for u128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1251:6
     |
1251 | impl Sub<u64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1267:6
     |
1267 | impl SubAssign<u64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1276:6
     |
1276 | impl Sub<u128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1293:6
     |
1293 | impl SubAssign<u128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1301:43
     |
1301 | forward_all_scalar_binop_to_val_val!(impl Sub<i32> for BigInt, sub);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1302:43
     |
1302 | forward_all_scalar_binop_to_val_val!(impl Sub<i64> for BigInt, sub);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1304:43
     |
1304 | forward_all_scalar_binop_to_val_val!(impl Sub<i128> for BigInt, sub);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1306:6
     |
1306 | impl Sub<i32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1318:6
     |
1318 | impl SubAssign<i32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1329:6
     |
1329 | impl Sub<BigInt> for i32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1342:6
     |
1342 | impl Sub<i64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1354:6
     |
1354 | impl SubAssign<i64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1365:6
     |
1365 | impl Sub<BigInt> for i64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1379:6
     |
1379 | impl Sub<i128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `SubAssign` in this scope
    --> src/bigint.rs:1392:6
     |
1392 | impl SubAssign<i128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::SubAssign;
     |

error[E0405]: cannot find trait `Sub` in this scope
    --> src/bigint.rs:1403:6
     |
1403 | impl Sub<BigInt> for i128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Sub;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1416:36
     |
1416 | forward_all_binop_to_ref_ref!(impl Mul for BigInt, mul);
     |                                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1418:14
     |
1418 | impl<'a, 'b> Mul<&'b BigInt> for &'a BigInt {
     |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1427:10
     |
1427 | impl<'a> MulAssign<&'a BigInt> for BigInt {
     |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1433:26
     |
1433 | forward_val_assign!(impl MulAssign for BigInt, mul_assign);
     |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1435:27
     |
1435 | promote_all_scalars!(impl Mul for BigInt, mul);
     |                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1436:34
     |
1436 | promote_all_scalars_assign!(impl MulAssign for BigInt, mul_assign);
     |                                  ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1437:55
     |
1437 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u32> for BigInt, mul);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1438:55
     |
1438 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u64> for BigInt, mul);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1440:55
     |
1440 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u128> for BigInt, mul);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1442:6
     |
1442 | impl Mul<u32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1451:6
     |
1451 | impl MulAssign<u32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1461:6
     |
1461 | impl Mul<u64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1470:6
     |
1470 | impl MulAssign<u64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1480:6
     |
1480 | impl Mul<u128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1489:6
     |
1489 | impl MulAssign<u128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1499:55
     |
1499 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<i32> for BigInt, mul);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1500:55
     |
1500 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<i64> for BigInt, mul);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1502:55
     |
1502 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<i128> for BigInt, mul);
     |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1504:6
     |
1504 | impl Mul<i32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1517:6
     |
1517 | impl MulAssign<i32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1529:6
     |
1529 | impl Mul<i64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1542:6
     |
1542 | impl MulAssign<i64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/bigint.rs:1554:6
     |
1554 | impl Mul<i128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0405]: cannot find trait `MulAssign` in this scope
    --> src/bigint.rs:1567:6
     |
1567 | impl MulAssign<i128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::MulAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1579:36
     |
1579 | forward_all_binop_to_ref_ref!(impl Div for BigInt, div);
     |                                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1581:14
     |
1581 | impl<'a, 'b> Div<&'b BigInt> for &'a BigInt {
     |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1591:10
     |
1591 | impl<'a> DivAssign<&'a BigInt> for BigInt {
     |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1597:26
     |
1597 | forward_val_assign!(impl DivAssign for BigInt, div_assign);
     |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1599:27
     |
1599 | promote_all_scalars!(impl Div for BigInt, div);
     |                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1600:34
     |
1600 | promote_all_scalars_assign!(impl DivAssign for BigInt, div_assign);
     |                                  ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1601:43
     |
1601 | forward_all_scalar_binop_to_val_val!(impl Div<u32> for BigInt, div);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1602:43
     |
1602 | forward_all_scalar_binop_to_val_val!(impl Div<u64> for BigInt, div);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1604:43
     |
1604 | forward_all_scalar_binop_to_val_val!(impl Div<u128> for BigInt, div);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1606:6
     |
1606 | impl Div<u32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1615:6
     |
1615 | impl DivAssign<u32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1625:6
     |
1625 | impl Div<BigInt> for u32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1634:6
     |
1634 | impl Div<u64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1643:6
     |
1643 | impl DivAssign<u64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1653:6
     |
1653 | impl Div<BigInt> for u64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1663:6
     |
1663 | impl Div<u128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1673:6
     |
1673 | impl DivAssign<u128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1684:6
     |
1684 | impl Div<BigInt> for u128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1693:43
     |
1693 | forward_all_scalar_binop_to_val_val!(impl Div<i32> for BigInt, div);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1694:43
     |
1694 | forward_all_scalar_binop_to_val_val!(impl Div<i64> for BigInt, div);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1696:43
     |
1696 | forward_all_scalar_binop_to_val_val!(impl Div<i128> for BigInt, div);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1698:6
     |
1698 | impl Div<i32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1711:6
     |
1711 | impl DivAssign<i32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1723:6
     |
1723 | impl Div<BigInt> for i32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1736:6
     |
1736 | impl Div<i64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1749:6
     |
1749 | impl DivAssign<i64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1761:6
     |
1761 | impl Div<BigInt> for i64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1775:6
     |
1775 | impl Div<i128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `DivAssign` in this scope
    --> src/bigint.rs:1789:6
     |
1789 | impl DivAssign<i128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::DivAssign;
     |

error[E0405]: cannot find trait `Div` in this scope
    --> src/bigint.rs:1802:6
     |
1802 | impl Div<BigInt> for i128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Div;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1815:36
     |
1815 | forward_all_binop_to_ref_ref!(impl Rem for BigInt, rem);
     |                                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1817:14
     |
1817 | impl<'a, 'b> Rem<&'b BigInt> for &'a BigInt {
     |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1827:10
     |
1827 | impl<'a> RemAssign<&'a BigInt> for BigInt {
     |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1833:26
     |
1833 | forward_val_assign!(impl RemAssign for BigInt, rem_assign);
     |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1835:27
     |
1835 | promote_all_scalars!(impl Rem for BigInt, rem);
     |                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1836:34
     |
1836 | promote_all_scalars_assign!(impl RemAssign for BigInt, rem_assign);
     |                                  ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1837:43
     |
1837 | forward_all_scalar_binop_to_val_val!(impl Rem<u32> for BigInt, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1838:43
     |
1838 | forward_all_scalar_binop_to_val_val!(impl Rem<u64> for BigInt, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1840:43
     |
1840 | forward_all_scalar_binop_to_val_val!(impl Rem<u128> for BigInt, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1842:6
     |
1842 | impl Rem<u32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1851:6
     |
1851 | impl RemAssign<u32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1861:6
     |
1861 | impl Rem<BigInt> for u32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1870:6
     |
1870 | impl Rem<u64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1879:6
     |
1879 | impl RemAssign<u64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1889:6
     |
1889 | impl Rem<BigInt> for u64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1899:6
     |
1899 | impl Rem<u128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1909:6
     |
1909 | impl RemAssign<u128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1920:6
     |
1920 | impl Rem<BigInt> for u128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1929:43
     |
1929 | forward_all_scalar_binop_to_val_val!(impl Rem<i32> for BigInt, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1930:43
     |
1930 | forward_all_scalar_binop_to_val_val!(impl Rem<i64> for BigInt, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1932:43
     |
1932 | forward_all_scalar_binop_to_val_val!(impl Rem<i128> for BigInt, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1934:6
     |
1934 | impl Rem<i32> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1947:6
     |
1947 | impl RemAssign<i32> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1958:6
     |
1958 | impl Rem<BigInt> for i32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1971:6
     |
1971 | impl Rem<i64> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:1984:6
     |
1984 | impl RemAssign<i64> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:1995:6
     |
1995 | impl Rem<BigInt> for i64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:2009:6
     |
2009 | impl Rem<i128> for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/bigint.rs:2022:6
     |
2022 | impl RemAssign<i128> for BigInt {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/bigint.rs:2033:6
     |
2033 | impl Rem<BigInt> for i128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Neg` in this scope
    --> src/bigint.rs:2046:6
     |
2046 | impl Neg for BigInt {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Neg;
     |

error[E0405]: cannot find trait `Neg` in this scope
    --> src/bigint.rs:2056:10
     |
2056 | impl<'a> Neg for &'a BigInt {
     |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Neg;
     |

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2427:38
     |
2427 |     fn digits_mut(&mut self) -> &mut Vec<BigDigit> {
     |                                      ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2543:36
     |
2543 |     pub fn new(sign: Sign, digits: Vec<u32>) -> BigInt {
     |                                    ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2728:41
     |
2728 |     pub fn to_bytes_be(&self) -> (Sign, Vec<u8>) {
     |                                         ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2743:41
     |
2743 |     pub fn to_bytes_le(&self) -> (Sign, Vec<u8>) {
     |                                         ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2758:41
     |
2758 |     pub fn to_signed_bytes_be(&self) -> Vec<u8> {
     |                                         ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2786:41
     |
2786 |     pub fn to_signed_bytes_le(&self) -> Vec<u8> {
     |                                         ^^^ not found in this scope

error[E0412]: cannot find type `String` in this scope
    --> src/bigint.rs:2815:47
     |
2815 |     pub fn to_str_radix(&self, radix: u32) -> String {
     |                                               ^^^^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2841:53
     |
2841 |     pub fn to_radix_be(&self, radix: u32) -> (Sign, Vec<u8>) {
     |                                                     ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/bigint.rs:2860:53
     |
2860 |     pub fn to_radix_le(&self, radix: u32) -> (Sign, Vec<u8>) {
     |                                                     ^^^ not found in this scope

error[E0405]: cannot find trait `Sum` in this scope
    --> src/macros.rs:334:17
     |
334  |         impl<T> Sum<T> for $res
     |                 ^^^
     | 
    ::: src/bigint.rs:2969:1
     |
2969 | impl_sum_iter_type!(BigInt);
     | ---------------------------- in this macro invocation
help: a trait with a similar name exists
     |
334  |         impl<T> Num<T> for $res
     |                 ^^^
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::iter::Sum;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/macros.rs:336:19
     |
336  |             $res: Add<T, Output = $res>,
     |                   ^^^ not found in this scope
     | 
    ::: src/bigint.rs:2969:1
     |
2969 | impl_sum_iter_type!(BigInt);
     | ---------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `Product` in this scope
    --> src/macros.rs:350:17
     |
350  |         impl<T> Product<T> for $res
     |                 ^^^^^^^ not found in this scope
     | 
    ::: src/bigint.rs:2970:1
     |
2970 | impl_product_iter_type!(BigInt);
     | -------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::iter::Product;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/macros.rs:352:19
     |
352  |             $res: Mul<T, Output = $res>,
     |                   ^^^ not found in this scope
     | 
    ::: src/bigint.rs:2970:1
     |
2970 | impl_product_iter_type!(BigInt);
     | -------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0425]: cannot find function `repeat` in this scope
   --> src/algorithms.rs:329:23
    |
329 |         p.data.extend(repeat(0).take(len));
    |                       ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::iter::repeat;
    |

error[E0425]: cannot find function `repeat` in this scope
   --> src/algorithms.rs:346:31
    |
346 |                 p.data.extend(repeat(0).take(len));
    |                               ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::iter::repeat;
    |

error[E0425]: cannot find value `Greater` in this scope
   --> src/algorithms.rs:581:58
    |
581 |         while cmp_slice(&prod.data[..], &a.data[j..]) == Greater {
    |                                                          ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::cmp::Ordering::Greater;
    |

error[E0412]: cannot find type `Cow` in this scope
   --> src/algorithms.rs:610:23
    |
610 | pub fn biguint_shl(n: Cow<BigUint>, bits: usize) -> BigUint {
    |                       ^^^ not found in this scope

error[E0425]: cannot find function `repeat` in this scope
   --> src/algorithms.rs:617:25
    |
617 |             data.extend(repeat(0).take(n_unit));
    |                         ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::iter::repeat;
    |

error[E0412]: cannot find type `Cow` in this scope
   --> src/algorithms.rs:640:23
    |
640 | pub fn biguint_shr(n: Cow<BigUint>, bits: usize) -> BigUint {
    |                       ^^^ not found in this scope

error[E0412]: cannot find type `Ordering` in this scope
   --> src/algorithms.rs:666:53
    |
666 | pub fn cmp_slice(a: &[BigDigit], b: &[BigDigit]) -> Ordering {
    |                                                     ^^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
1   | use core::cmp::Ordering;
    |
1   | use core::sync::atomic::Ordering;
    |

error[E0425]: cannot find value `Less` in this scope
   --> src/algorithms.rs:672:16
    |
672 |         return Less;
    |                ^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::cmp::Ordering::Less;
    |

error[E0425]: cannot find value `Greater` in this scope
   --> src/algorithms.rs:675:16
    |
675 |         return Greater;
    |                ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::cmp::Ordering::Greater;
    |

error[E0425]: cannot find value `Less` in this scope
   --> src/algorithms.rs:680:20
    |
680 |             return Less;
    |                    ^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::cmp::Ordering::Less;
    |

error[E0425]: cannot find value `Greater` in this scope
   --> src/algorithms.rs:683:20
    |
683 |             return Greater;
    |                    ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::cmp::Ordering::Greater;
    |

error[E0425]: cannot find value `Equal` in this scope
   --> src/algorithms.rs:686:12
    |
686 |     return Equal;
    |            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
1   | use core::cmp::Ordering::Equal;
    |

error[E0412]: cannot find type `Vec` in this scope
  --> src/biguint.rs:47:11
   |
47 |     data: Vec<BigDigit>,
   |           ^^^ not found in this scope

error[E0412]: cannot find type `Ordering` in this scope
  --> src/biguint.rs:63:54
   |
63 |     fn partial_cmp(&self, other: &BigUint) -> Option<Ordering> {
   |                                                      ^^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
   |
2  | use core::cmp::Ordering;
   |
2  | use core::sync::atomic::Ordering;
   |

error[E0412]: cannot find type `Ordering` in this scope
  --> src/biguint.rs:70:39
   |
70 |     fn cmp(&self, other: &BigUint) -> Ordering {
   |                                       ^^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
   |
2  | use core::cmp::Ordering;
   |
2  | use core::sync::atomic::Ordering;
   |

error[E0405]: cannot find trait `FromStr` in this scope
   --> src/biguint.rs:114:6
    |
114 | impl FromStr for BigUint {
    |      ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::str::FromStr;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/biguint.rs:274:29
    |
274 | forward_val_val_binop!(impl BitAnd for BigUint, bitand);
    |                             ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/biguint.rs:275:29
    |
275 | forward_ref_val_binop!(impl BitAnd for BigUint, bitand);
    |                             ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/biguint.rs:279:14
    |
279 | impl<'a, 'b> BitAnd<&'b BigUint> for &'a BigUint {
    |              ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAndAssign` in this scope
   --> src/biguint.rs:293:26
    |
293 | forward_val_assign!(impl BitAndAssign for BigUint, bitand_assign);
    |                          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAndAssign;
    |

error[E0405]: cannot find trait `BitAnd` in this scope
   --> src/biguint.rs:295:10
    |
295 | impl<'a> BitAnd<&'a BigUint> for BigUint {
    |          ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAnd;
    |

error[E0405]: cannot find trait `BitAndAssign` in this scope
   --> src/biguint.rs:304:10
    |
304 | impl<'a> BitAndAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitAndAssign;
    |

error[E0405]: cannot find trait `BitOr` in this scope
   --> src/biguint.rs:315:48
    |
315 | forward_all_binop_to_val_ref_commutative!(impl BitOr for BigUint, bitor);
    |                                                ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOr;
    |

error[E0405]: cannot find trait `BitOrAssign` in this scope
   --> src/biguint.rs:316:26
    |
316 | forward_val_assign!(impl BitOrAssign for BigUint, bitor_assign);
    |                          ^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOrAssign;
    |

error[E0405]: cannot find trait `BitOr` in this scope
   --> src/biguint.rs:318:10
    |
318 | impl<'a> BitOr<&'a BigUint> for BigUint {
    |          ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOr;
    |

error[E0405]: cannot find trait `BitOrAssign` in this scope
   --> src/biguint.rs:326:10
    |
326 | impl<'a> BitOrAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitOrAssign;
    |

error[E0405]: cannot find trait `BitXor` in this scope
   --> src/biguint.rs:339:48
    |
339 | forward_all_binop_to_val_ref_commutative!(impl BitXor for BigUint, bitxor);
    |                                                ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXor;
    |

error[E0405]: cannot find trait `BitXorAssign` in this scope
   --> src/biguint.rs:340:26
    |
340 | forward_val_assign!(impl BitXorAssign for BigUint, bitxor_assign);
    |                          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXorAssign;
    |

error[E0405]: cannot find trait `BitXor` in this scope
   --> src/biguint.rs:342:10
    |
342 | impl<'a> BitXor<&'a BigUint> for BigUint {
    |          ^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXor;
    |

error[E0405]: cannot find trait `BitXorAssign` in this scope
   --> src/biguint.rs:350:10
    |
350 | impl<'a> BitXorAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::BitXorAssign;
    |

error[E0405]: cannot find trait `Shl` in this scope
   --> src/biguint.rs:364:6
    |
364 | impl Shl<usize> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shl;
    |

error[E0405]: cannot find trait `Shl` in this scope
   --> src/biguint.rs:372:10
    |
372 | impl<'a> Shl<usize> for &'a BigUint {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shl;
    |

error[E0405]: cannot find trait `ShlAssign` in this scope
   --> src/biguint.rs:381:6
    |
381 | impl ShlAssign<usize> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::ShlAssign;
    |

error[E0405]: cannot find trait `Shr` in this scope
   --> src/biguint.rs:389:6
    |
389 | impl Shr<usize> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shr;
    |

error[E0405]: cannot find trait `Shr` in this scope
   --> src/biguint.rs:397:10
    |
397 | impl<'a> Shr<usize> for &'a BigUint {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Shr;
    |

error[E0405]: cannot find trait `ShrAssign` in this scope
   --> src/biguint.rs:406:6
    |
406 | impl ShrAssign<usize> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::ShrAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:492:48
    |
492 | forward_all_binop_to_val_ref_commutative!(impl Add for BigUint, add);
    |                                                ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/biguint.rs:493:26
    |
493 | forward_val_assign!(impl AddAssign for BigUint, add_assign);
    |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:495:10
    |
495 | impl<'a> Add<&'a BigUint> for BigUint {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/biguint.rs:503:10
    |
503 | impl<'a> AddAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:520:32
    |
520 | promote_unsigned_scalars!(impl Add for BigUint, add);
    |                                ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/biguint.rs:521:39
    |
521 | promote_unsigned_scalars_assign!(impl AddAssign for BigUint, add_assign);
    |                                       ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:522:55
    |
522 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u32> for BigUint, add);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:523:55
    |
523 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u64> for BigUint, add);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:525:55
    |
525 | forward_all_scalar_binop_to_val_val_commutative!(impl Add<u128> for BigUint, add);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:527:6
    |
527 | impl Add<u32> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/biguint.rs:537:6
    |
537 | impl AddAssign<u32> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:553:6
    |
553 | impl Add<u64> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/biguint.rs:563:6
    |
563 | impl AddAssign<u64> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Add` in this scope
   --> src/biguint.rs:583:6
    |
583 | impl Add<u128> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Add;
    |

error[E0405]: cannot find trait `AddAssign` in this scope
   --> src/biguint.rs:594:6
    |
594 | impl AddAssign<u128> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::AddAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:621:29
    |
621 | forward_val_val_binop!(impl Sub for BigUint, sub);
    |                             ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:622:29
    |
622 | forward_ref_ref_binop!(impl Sub for BigUint, sub);
    |                             ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `SubAssign` in this scope
   --> src/biguint.rs:623:26
    |
623 | forward_val_assign!(impl SubAssign for BigUint, sub_assign);
    |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::SubAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:625:10
    |
625 | impl<'a> Sub<&'a BigUint> for BigUint {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `SubAssign` in this scope
   --> src/biguint.rs:633:10
    |
633 | impl<'a> SubAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::SubAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:640:10
    |
640 | impl<'a> Sub<BigUint> for &'a BigUint {
    |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:658:32
    |
658 | promote_unsigned_scalars!(impl Sub for BigUint, sub);
    |                                ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `SubAssign` in this scope
   --> src/biguint.rs:659:39
    |
659 | promote_unsigned_scalars_assign!(impl SubAssign for BigUint, sub_assign);
    |                                       ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::SubAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:660:43
    |
660 | forward_all_scalar_binop_to_val_val!(impl Sub<u32> for BigUint, sub);
    |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:661:43
    |
661 | forward_all_scalar_binop_to_val_val!(impl Sub<u64> for BigUint, sub);
    |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:663:43
    |
663 | forward_all_scalar_binop_to_val_val!(impl Sub<u128> for BigUint, sub);
    |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:665:6
    |
665 | impl Sub<u32> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `SubAssign` in this scope
   --> src/biguint.rs:674:6
    |
674 | impl SubAssign<u32> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::SubAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:681:6
    |
681 | impl Sub<BigUint> for u32 {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:695:6
    |
695 | impl Sub<u64> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `SubAssign` in this scope
   --> src/biguint.rs:705:6
    |
705 | impl SubAssign<u64> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::SubAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:714:6
    |
714 | impl Sub<BigUint> for u64 {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:730:6
    |
730 | impl Sub<u128> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `SubAssign` in this scope
   --> src/biguint.rs:740:6
    |
740 | impl SubAssign<u128> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::SubAssign;
    |

error[E0405]: cannot find trait `Sub` in this scope
   --> src/biguint.rs:749:6
    |
749 | impl Sub<BigUint> for u128 {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Sub;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:764:36
    |
764 | forward_all_binop_to_ref_ref!(impl Mul for BigUint, mul);
    |                                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `MulAssign` in this scope
   --> src/biguint.rs:765:26
    |
765 | forward_val_assign!(impl MulAssign for BigUint, mul_assign);
    |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::MulAssign;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:767:14
    |
767 | impl<'a, 'b> Mul<&'b BigUint> for &'a BigUint {
    |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `MulAssign` in this scope
   --> src/biguint.rs:775:10
    |
775 | impl<'a> MulAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::MulAssign;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:782:32
    |
782 | promote_unsigned_scalars!(impl Mul for BigUint, mul);
    |                                ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `MulAssign` in this scope
   --> src/biguint.rs:783:39
    |
783 | promote_unsigned_scalars_assign!(impl MulAssign for BigUint, mul_assign);
    |                                       ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::MulAssign;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:784:55
    |
784 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u32> for BigUint, mul);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:785:55
    |
785 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u64> for BigUint, mul);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:787:55
    |
787 | forward_all_scalar_binop_to_val_val_commutative!(impl Mul<u128> for BigUint, mul);
    |                                                       ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:789:6
    |
789 | impl Mul<u32> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `MulAssign` in this scope
   --> src/biguint.rs:798:6
    |
798 | impl MulAssign<u32> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::MulAssign;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:812:6
    |
812 | impl Mul<u64> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `MulAssign` in this scope
   --> src/biguint.rs:821:6
    |
821 | impl MulAssign<u64> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::MulAssign;
    |

error[E0405]: cannot find trait `Mul` in this scope
   --> src/biguint.rs:836:6
    |
836 | impl Mul<u128> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Mul;
    |

error[E0405]: cannot find trait `MulAssign` in this scope
   --> src/biguint.rs:846:6
    |
846 | impl MulAssign<u128> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::MulAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:860:36
    |
860 | forward_all_binop_to_ref_ref!(impl Div for BigUint, div);
    |                                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `DivAssign` in this scope
   --> src/biguint.rs:861:26
    |
861 | forward_val_assign!(impl DivAssign for BigUint, div_assign);
    |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::DivAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:863:14
    |
863 | impl<'a, 'b> Div<&'b BigUint> for &'a BigUint {
    |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `DivAssign` in this scope
   --> src/biguint.rs:872:10
    |
872 | impl<'a> DivAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::DivAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:879:32
    |
879 | promote_unsigned_scalars!(impl Div for BigUint, div);
    |                                ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `DivAssign` in this scope
   --> src/biguint.rs:880:39
    |
880 | promote_unsigned_scalars_assign!(impl DivAssign for BigUint, div_assign);
    |                                       ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::DivAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:881:43
    |
881 | forward_all_scalar_binop_to_val_val!(impl Div<u32> for BigUint, div);
    |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:882:43
    |
882 | forward_all_scalar_binop_to_val_val!(impl Div<u64> for BigUint, div);
    |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:884:43
    |
884 | forward_all_scalar_binop_to_val_val!(impl Div<u128> for BigUint, div);
    |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:886:6
    |
886 | impl Div<u32> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `DivAssign` in this scope
   --> src/biguint.rs:895:6
    |
895 | impl DivAssign<u32> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::DivAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:902:6
    |
902 | impl Div<BigUint> for u32 {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:915:6
    |
915 | impl Div<u64> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `DivAssign` in this scope
   --> src/biguint.rs:924:6
    |
924 | impl DivAssign<u64> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::DivAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:931:6
    |
931 | impl Div<BigUint> for u64 {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:946:6
    |
946 | impl Div<u128> for BigUint {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `DivAssign` in this scope
   --> src/biguint.rs:956:6
    |
956 | impl DivAssign<u128> for BigUint {
    |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::DivAssign;
    |

error[E0405]: cannot find trait `Div` in this scope
   --> src/biguint.rs:964:6
    |
964 | impl Div<BigUint> for u128 {
    |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Div;
    |

error[E0405]: cannot find trait `Rem` in this scope
   --> src/biguint.rs:984:36
    |
984 | forward_all_binop_to_ref_ref!(impl Rem for BigUint, rem);
    |                                    ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Rem;
    |

error[E0405]: cannot find trait `RemAssign` in this scope
   --> src/biguint.rs:985:26
    |
985 | forward_val_assign!(impl RemAssign for BigUint, rem_assign);
    |                          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::RemAssign;
    |

error[E0405]: cannot find trait `Rem` in this scope
   --> src/biguint.rs:987:14
    |
987 | impl<'a, 'b> Rem<&'b BigUint> for &'a BigUint {
    |              ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::Rem;
    |

error[E0405]: cannot find trait `RemAssign` in this scope
   --> src/biguint.rs:996:10
    |
996 | impl<'a> RemAssign<&'a BigUint> for BigUint {
    |          ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
2   | use core::ops::RemAssign;
    |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1003:32
     |
1003 | promote_unsigned_scalars!(impl Rem for BigUint, rem);
     |                                ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1004:39
     |
1004 | promote_unsigned_scalars_assign!(impl RemAssign for BigUint, rem_assign);
     |                                       ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1005:43
     |
1005 | forward_all_scalar_binop_to_val_val!(impl Rem<u32> for BigUint, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1006:43
     |
1006 | forward_all_scalar_binop_to_val_val!(impl Rem<u64> for BigUint, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1008:43
     |
1008 | forward_all_scalar_binop_to_val_val!(impl Rem<u128> for BigUint, rem);
     |                                           ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1010:6
     |
1010 | impl Rem<u32> for BigUint {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1019:6
     |
1019 | impl RemAssign<u32> for BigUint {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1026:6
     |
1026 | impl Rem<BigUint> for u32 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1053 | impl_rem_assign_scalar!(u128, to_u128);
     | --------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1053 | impl_rem_assign_scalar!(u128, to_u128);
     | --------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1054 | impl_rem_assign_scalar!(usize, to_usize);
     | ----------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1054 | impl_rem_assign_scalar!(usize, to_usize);
     | ----------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1055 | impl_rem_assign_scalar!(u64, to_u64);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1055 | impl_rem_assign_scalar!(u64, to_u64);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1056 | impl_rem_assign_scalar!(u32, to_u32);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1056 | impl_rem_assign_scalar!(u32, to_u32);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1057 | impl_rem_assign_scalar!(u16, to_u16);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1057 | impl_rem_assign_scalar!(u16, to_u16);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1058 | impl_rem_assign_scalar!(u8, to_u8);
     | ----------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1058 | impl_rem_assign_scalar!(u8, to_u8);
     | ----------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1060 | impl_rem_assign_scalar!(i128, to_i128);
     | --------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1060 | impl_rem_assign_scalar!(i128, to_i128);
     | --------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1061 | impl_rem_assign_scalar!(isize, to_isize);
     | ----------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1061 | impl_rem_assign_scalar!(isize, to_isize);
     | ----------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1062 | impl_rem_assign_scalar!(i64, to_i64);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1062 | impl_rem_assign_scalar!(i64, to_i64);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1063 | impl_rem_assign_scalar!(i32, to_i32);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1063 | impl_rem_assign_scalar!(i32, to_i32);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1064 | impl_rem_assign_scalar!(i16, to_i16);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1064 | impl_rem_assign_scalar!(i16, to_i16);
     | ------------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1038:41
     |
1038 |         forward_val_assign_scalar!(impl RemAssign for BigUint, $scalar, rem_assign);
     |                                         ^^^^^^^^^ not found in this scope
...
1065 | impl_rem_assign_scalar!(i8, to_i8);
     | ----------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1039:18
     |
1039 |         impl<'a> RemAssign<&'a BigUint> for $scalar {
     |                  ^^^^^^^^^ not found in this scope
...
1065 | impl_rem_assign_scalar!(i8, to_i8);
     | ----------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1067:6
     |
1067 | impl Rem<u64> for BigUint {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1076:6
     |
1076 | impl RemAssign<u64> for BigUint {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1083:6
     |
1083 | impl Rem<BigUint> for u64 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1094:6
     |
1094 | impl Rem<u128> for BigUint {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `RemAssign` in this scope
    --> src/biguint.rs:1104:6
     |
1104 | impl RemAssign<u128> for BigUint {
     |      ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::RemAssign;
     |

error[E0405]: cannot find trait `Rem` in this scope
    --> src/biguint.rs:1112:6
     |
1112 | impl Rem<BigUint> for u128 {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Rem;
     |

error[E0405]: cannot find trait `Neg` in this scope
    --> src/biguint.rs:1122:6
     |
1122 | impl Neg for BigUint {
     |      ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Neg;
     |

error[E0405]: cannot find trait `Neg` in this scope
    --> src/biguint.rs:1131:10
     |
1131 | impl<'a> Neg for &'a BigUint {
     |          ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Neg;
     |

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:1691:54
     |
1691 | fn to_bitwise_digits_le(u: &BigUint, bits: usize) -> Vec<u8> {
     |                                                      ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:1717:62
     |
1717 | fn to_inexact_bitwise_digits_le(u: &BigUint, bits: usize) -> Vec<u8> {
     |                                                              ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:1757:51
     |
1757 | fn to_radix_digits_le(u: &BigUint, radix: u32) -> Vec<u8> {
     |                                                   ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:1786:48
     |
1786 | pub fn to_radix_le(u: &BigUint, radix: u32) -> Vec<u8> {
     |                                                ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:1806:58
     |
1806 | pub fn to_str_radix_reversed(u: &BigUint, radix: u32) -> Vec<u8> {
     |                                                          ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:1832:24
     |
1832 |     pub fn new(digits: Vec<u32>) -> BigUint {
     |                        ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:2015:34
     |
2015 |     pub fn to_bytes_be(&self) -> Vec<u8> {
     |                                  ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:2032:34
     |
2032 |     pub fn to_bytes_le(&self) -> Vec<u8> {
     |                                  ^^^ not found in this scope

error[E0412]: cannot find type `String` in this scope
    --> src/biguint.rs:2052:47
     |
2052 |     pub fn to_str_radix(&self, radix: u32) -> String {
     |                                               ^^^^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:2073:46
     |
2073 |     pub fn to_radix_be(&self, radix: u32) -> Vec<u8> {
     |                                              ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:2094:46
     |
2094 |     pub fn to_radix_le(&self, radix: u32) -> Vec<u8> {
     |                                              ^^^ not found in this scope

error[E0405]: cannot find trait `Sum` in this scope
    --> src/macros.rs:334:17
     |
334  |         impl<T> Sum<T> for $res
     |                 ^^^
     | 
    ::: src/biguint.rs:2191:1
     |
2191 | impl_sum_iter_type!(BigUint);
     | ----------------------------- in this macro invocation
help: a trait with a similar name exists
     |
334  |         impl<T> Num<T> for $res
     |                 ^^^
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::iter::Sum;
     |

error[E0405]: cannot find trait `Add` in this scope
    --> src/macros.rs:336:19
     |
336  |             $res: Add<T, Output = $res>,
     |                   ^^^ not found in this scope
     | 
    ::: src/biguint.rs:2191:1
     |
2191 | impl_sum_iter_type!(BigUint);
     | ----------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Add;
     |

error[E0405]: cannot find trait `Product` in this scope
    --> src/macros.rs:350:17
     |
350  |         impl<T> Product<T> for $res
     |                 ^^^^^^^ not found in this scope
     | 
    ::: src/biguint.rs:2192:1
     |
2192 | impl_product_iter_type!(BigUint);
     | --------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::iter::Product;
     |

error[E0405]: cannot find trait `Mul` in this scope
    --> src/macros.rs:352:19
     |
352  |             $res: Mul<T, Output = $res>,
     |                   ^^^ not found in this scope
     | 
    ::: src/biguint.rs:2192:1
     |
2192 | impl_product_iter_type!(BigUint);
     | --------------------------------- in this macro invocation
help: possible candidate is found in another module, you can import it into scope
     |
2    | use core::ops::Mul;
     |

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:2196:38
     |
2196 |     fn digits_mut(&mut self) -> &mut Vec<BigDigit>;
     |                                      ^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> src/biguint.rs:2208:38
     |
2208 |     fn digits_mut(&mut self) -> &mut Vec<BigDigit> {
     |                                      ^^^ not found in this scope

error[E0405]: cannot find trait `Error` in this scope
   --> src/lib.rs:152:6
    |
152 | impl Error for ParseBigIntError {
    |      ^^^^^ not found in this scope

error: aborting due to 497 previous errors

Some errors occurred: E0405, E0412, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0405`.
builder for '/nix/store/z9nlbzmxsz6smr6l1yf1x1civh1x7ahl-rust_num-bigint-0.2.2.drv' failed with exit code 1
cannot build derivation '/nix/store/0sjm90mbycyx355l5qm993inll42swd8-rust_numtest-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/0sjm90mbycyx355l5qm993inll42swd8-rust_numtest-0.1.0.drv' failed

Failing build with html5ever

Hi,

I'm having issues building with nix for crates with html5ever as a dependency.

https://github.com/nuxeh/crate2nix-test is an example repo with a default.nix generated by crate2nix 0.3.0-beta.0

The build seems to fail due to the missing extern crate, new_debug_unreachable:

error[E0463]: can't find crate for `debug_unreachable`
  --> src/lib.rs:10:1
   |
10 | extern crate debug_unreachable;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.

I've done some debugging but haven't been able to track down what the issue is. The build order differs, and besides that, the only difference i can see is that the rustc invocations differ in the output directory, compared with building with cargo:

Running rustc --crate-name futf src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=4 --edition 2015 -C metadata=7a698c1757 -C extra-filename=-7a698c1757 --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern mac=/nix/store/bjcw280v92drg93d89zpkh997xljfl89-rust_mac-0.1.1/lib/libmac-c77a325080.rlib --extern new_debug_unreachable=/nix/store/qz5ffk70ibllz27awjnpp9v7rbcrxnq5-rust_new_debug_unreachable-1.0.3/lib/libnew_debug_unreachable-6437ae92c0.rlib --cap-lints allow --color always

--out-dir target/lib

Running `rustc --crate-name futf /home/ed/.cargo/registry/src/github.com-1ecc6299db9ec823/futf-0.1.4/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=b65310681f505b82 -C extra-filename=-b65310681f505b82 --out-dir /home/ed/git/url-bot-rs/target/debug/deps -L dependency=/home/ed/git/url-bot-rs/target/debug/deps --extern mac=/home/ed/git/url-bot-rs/target/debug/deps/libmac-705013cbc305aca9.rlib --extern debug_unreachable=/home/ed/git/url-bot-rs/target/debug/deps/libdebug_unreachable-6884cd8b03bd695e.rlib --cap-lints allow`

--out-dir /home/ed/git/url-bot-rs/target/debug/deps

Thanks.

target.'cfg(test)'.dependencies - unknown target `test`

With the following in Cargo.toml

[target.'cfg(test)'.dependencies]
tracing = { version = "0.1.5", features = ["log"] }

https://github.com/tokio-rs/tokio/blob/5efe31f2ed3c797e8055306a05faa3d7e786e7b6/tokio-net/Cargo.toml#L102

Crate2 nix creates statement like target."test" but the that target isn't defined anywhere.

$ nix-build Cargo.nix -A rootCrate
error: attribute 'test' missing, at crate2nix-issues/cfg-test/Cargo.nix:89:22
(use '--show-trace' to show detailed location information)

I created a minimal test project at https://github.com/andir/crate2nix-issues/tree/d1e6ef9f7d1ea59a0286ee040015ba671511cb05/cfg-test

Seeking Feedback: What is needed for a 1.0 release?

What does crate2nix miss for feeling ready for a 1.0 version?

I have plenty ideas for additional features but this is more about

  • future proofing the "public" attributes of the generated build files,
  • future proofing configuration (I am actually thinking about moving to a crate2nix.toml file instead of command line arguments),
  • generally having a solid basis so I can avoid incompatible changes in the future,
  • making crate2nix rock solid for the use cases it already provides,
  • good enough documentation.

What do you think?

How to add overrides to `defaultCrateOverrides`

The README mentions

If your library with native dependencies is not yet supported, you can create an overlay to add the needed configuration to the defaultCrateOverrides

But it’s not clear to me how that can be done. For example, I can’t find the string defaultCrateOverrides in the generated nix file.

nix-shell -f doesn't exist

The README documents the use of nix-shell -f multiple times however executing nix-shell -f on my end yields error: unrecognized flag '-f'

Error entering the shell

I can't enter the nix-shell on a fresh install of Nix unstable on Debian, any pointers?

$ nix-shell
error: file 'nixos-unstable' was not found in the Nix search path (add it using $NIX_PATH or -I), at /home/ed/git/crate2nix/shell.nix:5:16

$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable

$ echo $NIX_PATH 
nixpkgs=/home/ed/.nix-defexpr/channels/nixpkgs

Thanks.

not sure how to build protoc-rust-grpc

If I understand correctly I need to override buildInputs for the right crate. I think protoc is the one calling protoc --version (here). Does buildInputs add the bin to the PATH?

$ rg proto Cargo.lock | rg name
name = "protobuf"
name = "protobuf-codegen"
name = "protoc"
name = "protoc-rust"
name = "protoc-rust-grpc"
name = "test-proto" // my crate

deps

[build-dependencies]
protoc-rust-grpc = "0.6"

build.rs

fn main() {
    protoc_rust_grpc::run(protoc_rust_grpc::Args {
        out_dir: "src",
        includes: &[],
        input: &["helloworld.proto"],
        rust_protobuf: true,
        ..Default::default()
    })
    .expect("protoc-rust-grpc");
}

helloworld.proto

syntax = "proto3";

package something;

log

Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=4 --edition 2018 --cfg feature="default" --out-dir target/build/test-proto --emit=dep-info,link -L dependency=target/buildDeps --extern protoc_rust_grpc=/nix/store/f2q18n4d63jxrlj5s41ivgzz3ql88nn7-rust_protoc-rust-grpc-0.6.2-lib/lib/libprotoc_rust_grpc-57fc54afe7.rlib --cap-lints allow --color always
thread 'main' panicked at 'protoc version: Custom { kind: NotFound, error: "failed to spawn `\"protoc\" \"--version\"`: No such file or directory (os error 2)" }', src/libcore/result.rs:1165:5
with (import <nixpkgs> {});

let
  myCrateBase = callPackage ./Cargo.nix {};
  myCrate = myCrateBase.rootCrate.build.override {
    crateOverrides = defaultCrateOverrides // {
      protoc = attrs: {
        buildInputs = [
          protobuf
        ];
      };
    };
  };
in
myCrate

Crates with overlapping cfg conditions fails to build

The specific crate I'm trying to build is flate2. It has an optional dependency on miniz_oxide which is turned on by default, unless your target arch is wasm32 and your target os is not emscripten in which case miniz_oxide is a required dependency.

I'm not entirely sure how to handle such a case. Off the top of my head, it seems like we can't render target predicates without the additional information of the set of features that are also dependencies.

multiple matching crates for `lazy_static` when trying to compile `tracing-core`

Now that #37 has been fixed, I am able to get a little further with compiling my project using crate2nix.

When attempting to build, I encounter an error with multiple matching crates for lazy_static.

rust_tracing-core> error[E0464]: multiple matching crates for `lazy_static`
rust_tracing-core>   --> src/lib.rs:78:1
rust_tracing-core>    |
rust_tracing-core> 78 | extern crate lazy_static;
rust_tracing-core>    | ^^^^^^^^^^^^^^^^^^^^^^^^^
rust_tracing-core>    |
rust_tracing-core>    = note: candidates:
rust_tracing-core>            crate `lazy_static`: /nix/store/jql33z8cm1pssd1m70qd4d0bzb925f1w-rustc-1.37.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblazy_static-e27d2cebc85340fe.rlib
rust_tracing-core>            crate `lazy_static`: /nix/store/jql33z8cm1pssd1m70qd4d0bzb925f1w-rustc-1.37.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblazy_static-1a8d3023d6646c0e.rlib
rust_tracing-core> error[E0463]: can't find crate for `lazy_static`
rust_tracing-core>   --> src/lib.rs:78:1
rust_tracing-core>    |
rust_tracing-core> 78 | extern crate lazy_static;
rust_tracing-core>    | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
rust_tracing-core> error: aborting due to 2 previous errors
rust_tracing-core> For more information about this error, try `rustc --explain E0463`.
builder for '/nix/store/jkggrifvxjq57x215grk7p0khrmvyg1q-rust_tracing-core-0.1.7.drv' failed with exit code 1; last 10 log lines:
  
  error[E0463]: can't find crate for `lazy_static`
    --> src/lib.rs:78:1
     |
  78 | extern crate lazy_static;
     | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
  
  error: aborting due to 2 previous errors

nix-info -m

  • system: "x86_64-linux"
  • host os: Linux 5.3.11, NixOS, 19.09.1300.08e503bac6d (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3
  • channels(root): "nixos-19.09.1300.08e503bac6d"
  • channels(evanjs): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
    crate2nix version: crate2nix 0.6.0 (installed from master)

Happy to provide any other information that might help.

Prefetch downloads same repo multiple times

On the latest master, the following happens when running crate2nix generate for https://github.com/Hirevo/alexandrie:

Prefetching    1/1: https://github.com/rustasync/tide
Prefetching    2/1: https://github.com/rustasync/tide
Prefetching    3/1: https://github.com/rustasync/tide
Prefetching    4/1: https://github.com/rustasync/tide
Prefetching    5/1: https://github.com/rustasync/tide
Prefetching    6/1: https://github.com/rustasync/tide
Prefetching    7/1: https://github.com/rustasync/tide
Prefetching    8/1: https://github.com/rustasync/tide
Wrote hashes to ./crate-hashes.json.
Generated ./Cargo.nix successfully.

And it generates the following crate hashes:

{
  "tide 0.2.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-cookies 0.2.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-core 0.2.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-cors 0.2.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-forms 0.1.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-headers 0.1.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-log 0.1.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98",
  "tide-querystring 0.1.0 (git+https://github.com/rustasync/tide?rev=af0b900#af0b900bc447eb4410874752c9a7a35b9be79561)": "1izyw0132p1yzpd3frlqjmn4fy3z4l39x9k6rak5lgf9rj4gix98"
}

The problem is that multiple git packages with the same source doesn't get the same packageid, even though we only want to prefetch once, and you currently use that id to look up the hash.

Dependency on `rand = "0.7"` fails

I get an error when building with nix if my package depends on the rand package at version 0.7. There doesn't seem to be an issue with the previous version 0.6.5.

I am using the version of nixpkgs you have pinned (a2e219ec879fe3de62e9204ad33efb5b67a4a324).

Cargo.toml

[package]
name = "t"
version = "0.1.0"
edition = "2018"

[dependencies]
rand = "0.7"
Output
$ crate2nix generate && nix-build Cargo.nix -A rootCrate --arg pkgs 'import ./nixpkgs.nix {config={};}'
Prefetching    1/10: https://crates.io/api/v1/crates/c2-chacha/0.2.2/download
Prefetching    2/10: https://crates.io/api/v1/crates/cfg-if/0.1.9/download
Prefetching    3/10: https://crates.io/api/v1/crates/getrandom/0.1.11/download
Prefetching    4/10: https://crates.io/api/v1/crates/lazy_static/1.4.0/download
Prefetching    5/10: https://crates.io/api/v1/crates/ppv-lite86/0.2.5/download
Prefetching    6/10: https://crates.io/api/v1/crates/rand/0.7.0/download
Prefetching    7/10: https://crates.io/api/v1/crates/rand_chacha/0.2.1/download
Prefetching    8/10: https://crates.io/api/v1/crates/rand_core/0.5.1/download
Prefetching    9/10: https://crates.io/api/v1/crates/rand_hc/0.2.0/download
Prefetching   10/10: https://crates.io/api/v1/crates/wasi/0.5.0/download
Wrote hashes to ./crate-hashes.json.
Generated ./Cargo.nix successfully.
these derivations will be built:
  /nix/store/hsagy1dw82qssz23vdj9rngznznjblmm-rust_rand-0.7.0.drv
  /nix/store/ymmq9lhhp5lj4k5161bdach7z0b5xgyl-rust_t-0.1.0.drv
building '/nix/store/hsagy1dw82qssz23vdj9rngznznjblmm-rust_rand-0.7.0.drv'...
unpacking sources
unpacking source archive /nix/store/g8rs43fnnzq9ibv60qwi81f8d1vpwymj-rand-0.7.0.tar.gz
source root is rand-0.7.0.tar.gz
patching sources
configuring
building
Building src/lib.rs (rand)
Running rustc --crate-name rand src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=12 --edition 2018 -C metadata=f43f81b124 -C extra-filename=-f43f81b124 --cfg feature="alloc" --cfg feature="default" --cfg feature="getrandom" --cfg feature="getrandom_package" --cfg feature="rand_core/alloc" --cfg feature="rand_core/getrandom" --cfg feature="rand_core/std" --cfg feature="std" --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern getrandom=/nix/store/61f6yqaaqckc5w30q2cfsvavgma5w5f9-rust_getrandom-0.1.11/lib/libgetrandom-b39e9273b9.rlib --extern libc=/nix/store/l5r0rvqhmhd16r191xks6wfgyqhz5lam-rust_libc-0.2.62/lib/liblibc-efa9f5b24f.rlib --extern rand_chacha=/nix/store/phvgnjvy2w2m3cnmnlwsvbik08w7fwf0-rust_rand_chacha-0.2.1/lib/librand_chacha-7f7ab7e140.rlib --extern rand_core=/nix/store/gpwiabvl10c9hksaxmv9c49gx2i8plga-rust_rand_core-0.5.1/lib/librand_core-ebabdf2568.rlib --cap-lints allow --color always
error[E0432]: unresolved import `getrandom_package`
  --> src/lib.rs:60:5
   |
60 | use getrandom_package as getrandom;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `getrandom_package` external crate

error[E0423]: expected function, found module `getrandom`
  --> src/rngs/os.rs:78:9
   |
78 |         getrandom(dest)?;
   |         ^^^^^^^^^ not a function
help: possible better candidates are found in other modules, you can import them into scope
   |
12 | use getrandom::getrandom;
   |
12 | use libc::getrandom;
   |

error: aborting due to 2 previous errors

Some errors occurred: E0423, E0432.
For more information about an error, try `rustc --explain E0423`.
builder for '/nix/store/hsagy1dw82qssz23vdj9rngznznjblmm-rust_rand-0.7.0.drv' failed with exit code 1
cannot build derivation '/nix/store/ymmq9lhhp5lj4k5161bdach7z0b5xgyl-rust_t-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ymmq9lhhp5lj4k5161bdach7z0b5xgyl-rust_t-0.1.0.drv' failed

In particular, rand@f3e6c75 (which seems to be the 0.7 release?) builds okay with cargo but fails to build in nix with crate2nix with the same error message. However, master seems to build fine. 🤔

FYI I am consuming rand as a transitive dependency of prost-build from prost.


Thanks for contributing to Rust in nix btw 🤗

Cannot build flate2 crate

Building the flate2 crate fails in the nix build but builds with cargo.

Testcase

Update: On the carnix branch in the testcase, I used carnix generate-nix --standalone --src . to generate the build files and built using nix-build Cargo.nix --attr nix_test and it works fine.

Build output

nix-build Cargo.nix --attr rootCrate.build | tee ~/nlog
these derivations will be built:
  /nix/store/8h7pwmcjs609qndm5p6hjjj6aa3pdp2w-rust_flate2-1.0.12.drv
  /nix/store/867xl42ma2hzzkaiaqdn2153y2akw07l-rust_nix-test-0.1.0.drv
building '/nix/store/8h7pwmcjs609qndm5p6hjjj6aa3pdp2w-rust_flate2-1.0.12.drv'...
unpacking sources
unpacking source archive /nix/store/wmnaidz3za0642pianadw8w3y68cxxp0-flate2-1.0.12.tar.gz
source root is flate2-1.0.12.tar.gz
patching sources
configuring
building
Building src/lib.rs (flate2)
Running rustc --crate-name flate2 src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=2 --edition 2018 -C metadata=a55c485f99 -C extra-filename=-a55c485f99 --cfg
feature="default" --cfg feature="miniz_oxide" --cfg feature="rust_backend" --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern cfg_if=/nix/store/
c3lddq79d9cwbl92via76pp3zs2mih4l-rust_cfg-if-0.1.10/lib/libcfg_if-271c7a6275.rlib --extern crc32fast=/nix/store/bjdk5m7gwx8wz72ccz3c38pp2pzrhzwr-rust_crc32fast-1.2.0/lib/
libcrc32fast-0e271bcda6.rlib --extern libc=/nix/store/5k4amvz95vz4b9v3bs7kwzs06yhj0hw6-rust_libc-0.2.65/lib/liblibc-325f2598fe.rlib --cap-lints allow --color always
error[E0432]: unresolved import `miniz_oxide`
 --> src/ffi/rust.rs:8:9
  |
8 | pub use miniz_oxide::*;
  |         ^^^^^^^^^^^ use of undeclared type or module `miniz_oxide`

error[E0433]: failed to resolve: use of undeclared type or module `MZFlush`
  --> src/ffi/rust.rs:10:32
   |
10 | pub const MZ_NO_FLUSH: isize = MZFlush::None as isize;
   |                                ^^^^^^^ use of undeclared type or module `MZFlush`

error[E0433]: failed to resolve: use of undeclared type or module `MZFlush`
  --> src/ffi/rust.rs:11:37
   |
11 | pub const MZ_PARTIAL_FLUSH: isize = MZFlush::Partial as isize;
   |                                     ^^^^^^^ use of undeclared type or module `MZFlush`

error[E0433]: failed to resolve: use of undeclared type or module `MZFlush`
  --> src/ffi/rust.rs:12:34
   |
13 | pub const MZ_FULL_FLUSH: isize = MZFlush::Full as isize;
   |                                  ^^^^^^^ use of undeclared type or module `MZFlush`

error[E0433]: failed to resolve: use of undeclared type or module `MZFlush`
  --> src/ffi/rust.rs:14:30
   |
14 | pub const MZ_FINISH: isize = MZFlush::Finish as isize;
   |                              ^^^^^^^ use of undeclared type or module `MZFlush`

error[E0433]: failed to resolve: use of undeclared type or module `DataFormat`
  --> src/ffi/rust.rs:21:9
   |
21 |         DataFormat::Zlib
   |         ^^^^^^^^^^ use of undeclared type or module `DataFormat`

error[E0433]: failed to resolve: use of undeclared type or module `DataFormat`
  --> src/ffi/rust.rs:23:9
   |
23 |         DataFormat::Raw
   |         ^^^^^^^^^^ use of undeclared type or module `DataFormat`

error[E0433]: failed to resolve: use of undeclared type or module `InflateState`
  --> src/ffi/rust.rs:53:20
   |
53 |             inner: InflateState::new_boxed(format),
   |                    ^^^^^^^^^^^^ use of undeclared type or module `InflateState`

error[E0433]: failed to resolve: use of undeclared type or module `MZFlush`
  --> src/ffi/rust.rs:65:21
   |
65 |         let flush = MZFlush::new(flush as i32).unwrap();
   |                     ^^^^^^^ use of undeclared type or module `MZFlush`

error[E0433]: failed to resolve: use of undeclared type or module `inflate`
  --> src/ffi/rust.rs:67:19
   |
67 |         let res = inflate::stream::inflate(&mut self.inner, input, output, flush);
   |                   ^^^^^^^ use of undeclared type or module `inflate`

error[E0433]: failed to resolve: use of undeclared type or module `MZStatus`
  --> src/ffi/rust.rs:73:17
   |
73 |                 MZStatus::Ok => Ok(Status::Ok),
   |                 ^^^^^^^^ use of undeclared type or module `MZStatus`

error[E0433]: failed to resolve: use of undeclared type or module `MZStatus`
  --> src/ffi/rust.rs:74:17
   |
74 |                 MZStatus::StreamEnd => Ok(Status::StreamEnd),
   |                 ^^^^^^^^ use of undeclared type or module `MZStatus`

error[E0433]: failed to resolve: use of undeclared type or module `MZStatus`
  --> src/ffi/rust.rs:75:17
   |
75 |                 MZStatus::NeedDict => {
   |                 ^^^^^^^^ use of undeclared type or module `MZStatus`

error[E0433]: failed to resolve: use of undeclared type or module `MZError`
  --> src/ffi/rust.rs:80:17
   |
80 |                 MZError::Buf => Ok(Status::BufError),
   |                 ^^^^^^^ use of undeclared type or module `MZError`

error[E0433]: failed to resolve: use of undeclared type or module `MZFlush`
   --> src/ffi/rust.rs:148:21
    |
148 |         let flush = MZFlush::new(flush as i32).unwrap();
    |                     ^^^^^^^ use of undeclared type or module `MZFlush`

error[E0433]: failed to resolve: use of undeclared type or module `deflate`
   --> src/ffi/rust.rs:149:19
    |
149 |         let res = deflate::stream::deflate(&mut self.inner, input, output, flush);

    |                   ^^^^^^^ use of undeclared type or module `deflate`

error[E0433]: failed to resolve: use of undeclared type or module `MZStatus`
   --> src/ffi/rust.rs:155:17
    |
155 |                 MZStatus::Ok => Ok(Status::Ok),
    |                 ^^^^^^^^ use of undeclared type or module `MZStatus`

error[E0433]: failed to resolve: use of undeclared type or module `MZStatus`
   --> src/ffi/rust.rs:156:17
    |
156 |                 MZStatus::StreamEnd => Ok(Status::StreamEnd),
    |                 ^^^^^^^^ use of undeclared type or module `MZStatus`

error[E0433]: failed to resolve: use of undeclared type or module `MZStatus`
   --> src/ffi/rust.rs:157:17
    |
157 |                 MZStatus::NeedDict => Err(CompressError(())),
    |                 ^^^^^^^^ use of undeclared type or module `MZStatus`

error[E0433]: failed to resolve: use of undeclared type or module `MZError`
   --> src/ffi/rust.rs:160:17
    |
160 |                 MZError::Buf => Ok(Status::BufError),
    |                 ^^^^^^^ use of undeclared type or module `MZError`

error[E0412]: cannot find type `DataFormat` in this scope
  --> src/ffi/rust.rs:19:43
   |
19 | fn format_from_bool(zlib_header: bool) -> DataFormat {
   |                                           ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `InflateState` in this scope
  --> src/ffi/rust.rs:28:16
   |
28 |     inner: Box<InflateState>,
   |                ^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `CompressorOxide` in this scope
   --> src/ffi/rust.rs:106:16
    |
106 |     inner: Box<CompressorOxide>,
    |                ^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `CompressorOxide` in this scope
   --> src/ffi/rust.rs:131:28
    |
131 |         let mut inner: Box<CompressorOxide> = Box::default();
    |                            ^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `MZ_DEFAULT_WINDOW_BITS` in module `ffi`
   --> src/mem.rs:191:59
    |
191 |             inner: Deflate::make(level, zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8),
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_DEFAULT_WINDOW_BITS` in module `ffi`
   --> src/mem.rs:337:52
    |
337 |             inner: Inflate::make(zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8),
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0080]: evaluation of constant value failed
  --> src/mem.rs:50:12
   |
50 |     None = ffi::MZ_NO_FLUSH as isize,
   |            ^^^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
  --> src/mem.rs:59:12
   |
59 |     Sync = ffi::MZ_SYNC_FLUSH as isize,
   |            ^^^^^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
  --> src/mem.rs:69:15
   |
69 |     Partial = ffi::MZ_PARTIAL_FLUSH as isize,
   |               ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
  --> src/mem.rs:76:12
   |
76 |     Full = ffi::MZ_FULL_FLUSH as isize,
   |            ^^^^^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
  --> src/mem.rs:82:14
   |
82 |     Finish = ffi::MZ_FINISH as isize,
   |              ^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
  --> src/mem.rs:95:12
   |
95 |     None = ffi::MZ_NO_FLUSH as isize,
   |            ^^^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
   --> src/mem.rs:104:12
    |
104 |     Sync = ffi::MZ_SYNC_FLUSH as isize,
    |            ^^^^^^^^^^^^^^^^^^ referenced constant has errors

error[E0080]: evaluation of constant value failed
   --> src/mem.rs:110:14
    |
110 |     Finish = ffi::MZ_FINISH as isize,
    |              ^^^^^^^^^^^^^^ referenced constant has errors

error: aborting due to 35 previous errors

Some errors have detailed explanations: E0080, E0412, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0080`.
builder for '/nix/store/8h7pwmcjs609qndm5p6hjjj6aa3pdp2w-rust_flate2-1.0.12.drv' failed with exit code 1
cannot build derivation '/nix/store/867xl42ma2hzzkaiaqdn2153y2akw07l-rust_nix-test-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/867xl42ma2hzzkaiaqdn2153y2akw07l-rust_nix-test-0.1.0.drv' failed

Prefetching denominator is wrong

The snippet from #59 shows:

Prefetching    1/1: https://github.com/rustasync/tide
Prefetching    2/1: https://github.com/rustasync/tide
Prefetching    3/1: https://github.com/rustasync/tide
Prefetching    4/1: https://github.com/rustasync/tide
Prefetching    5/1: https://github.com/rustasync/tide
Prefetching    6/1: https://github.com/rustasync/tide
Prefetching    7/1: https://github.com/rustasync/tide
Prefetching    8/1: https://github.com/rustasync/tide
Wrote hashes to ./crate-hashes.json.
Generated ./Cargo.nix successfully.

It should be 8.

I've already fixed this, and a PR is forthcoming but wanted to document the issue itself for posterity.

Bug with build.rs and `built` crate

Error building https://github.com/nuxeh/url-bot-rs, this time with a build.rs...

Building build.rs (url-bot-rs)
Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=4 --edition 2015 --out-dir target/build/url-bot-rs --emit=dep-info,link -L dependency=target/buildDeps --extern built=/nix/store/si7mi7qqdm55njgvgajdlbs8ida9rn2w-rust_built-0.3.0/lib/libbuilt-8c884e3e71.rlib --extern man=/nix/store/4i8bvbjfsmjsnldxifnw490s60jhrwi0-rust_man-0.3.0/lib/libman-3ad10e7239.rlib --cap-lints allow -L native=/nix/store/1gb46kwmhh86j453rwd09218ryh7mn1h-libgit2-0.26.6/lib -L native=/nix/store/2xb0wphs5h89i0k1r8lya9fpsjwkn7xm-openssl-1.0.2r/lib -L native=/nix/store/g4rgyrkq7yfnqfmv5hxsc32x6cydh1nc-sqlite-3.26.0/lib -L native=/nix/store/iip6qkdai647xww8wjw1q1775nmi6xq9-rust_libz-sys-1.0.25/lib/libz-sys.out/build -L native=/nix/store/iki0dq5ivii3hiwvxx81ppazjlqjk81l-rust_backtrace-sys-0.1.28/lib/backtrace-sys.out -l crypto -l git2 -l sqlite3 -l ssl -l static=backtrace -l static=z --color always
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:355:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic
   9: built::write_built_file_with_opts
  10: built::write_built_file
  11: build_script_build::main
  12: std::rt::lang_start::{{closure}}
  13: std::panicking::try::do_call
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: main
  17: __libc_start_main
  18: _start
             at ../sysdeps/x86_64/start.S:120
builder for '/nix/store/v58mc6kd167wn73p5a8rq4vga7g5iz9x-rust_url-bot-rs-0.2.0.drv' failed with exit code 101
error: build of '/nix/store/v58mc6kd167wn73p5a8rq4vga7g5iz9x-rust_url-bot-rs-0.2.0.drv' failed

Environment variables not accessible in build script.

I have a packages that specifies a build script called build.rs that I am using to create the CFFI. I think that the environment variable CARGO_MANIFEST_DIR is not properly set during nix buildtime, as I get the error message: 'main' panicked at 'Unable to generate C bindings.: CargoMetadata("/build/traj/Cargo.toml", Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }))', src/libcore/result.rs:999:5

Git sources of child crates are not properly used

When building a package from a git source where the git repository contains multiple crates the nix expression (sometimes?) doesn't know about the child directory for dependency in relative child directories.

Example:

Imagine the following section in your Cargo.toml:

[dependencies.rocksdb]
git = "https://github.com/rust-rocksdb/rust-rocksdb"
rev = "bc8520a86e96c38f79caac0d09349a01cbd113e9"
branch = "0.12.2"
default-features = false
features = ["lz4"]

Then looking further into the Cargo.toml of the rocksdb crate:

[dependencies]
libc = "0.2"
librocksdb-sys = { path = "librocksdb-sys", version = "5.18.3" }

(https://github.com/rust-rocksdb/rust-rocksdb/blob/bc8520a86e96c38f79caac0d09349a01cbd113e9/Cargo.toml#L26-L28)

We see that the librocksdb-sys crate is supposed to be at the relative path librocksdb-sys within the rocksdb crate source. When we now look at the definition of librocksdb-sys in the generated Cargo.nix we see the following:

      "librocksdb-sys …"
        = rec {
          crateName = "librocksdb-sys";
          version = "5.18.3";                                                                                                                                                                                                                  
          edition = "2015";                                                                                                                                                                                                                    
          src = builtins.fetchgit {                                                                                                                                                                                                                    
            url = "https://github.com/rust-rocksdb/rust-rocksdb";                                                                                                                                                                        
            rev = "bc8520a86e96c38f79caac0d09349a01cbd113e9";                                                                                                                                                                                  
            sha256 = "…";                                                                                                                                                                   
          };                                                                                                                                                                                                              
          authors = [];                                                                                                                                                                                                                                   
          dependencies = {};                                                                                                                                                                                                                                   
          buildDependencies = {};                                                                                                                                                                                                                                   
          features = {                                                                                                                                                                                                                         
            "default" = [ "static" ];                                                                                                                                                                                                          
          };                                                                                                                                                                                                                                   
          resolvedDefaultFeatures = [ "default" "lz4" "static" ];                                                                                                                                                                              
        };                   

What is missing here is the child directory that actually hosts the crate librocksdb-sys. By changing the src attribute to

src = (builtins.fetchgit {                                                                                                                                                                                                                    
            url = "https://github.com/rust-rocksdb/rust-rocksdb";                                                                                                                                                                        
            rev = "bc8520a86e96c38f79caac0d09349a01cbd113e9";                                                                                                                                                                                  
            sha256 = "…";                                                                                                                                                                   
          }) + "/librocksdb-sys";

we can workaround the issue.

I spent some time looking at how cargo handles those internally. It seems like each directory is cloned into your local "db" (in cargo speech?) at ~/.cargo/git/checkouts/<repo>-<somehash>/<git short ref>/. In the above example the package_path of our package then is ~/.cargo/git/checkouts/<repo>-<somehash>/<git short ref>/librocksdb-sys/.

The choices we have here seem to be limited. The trivial approach to fixing this would be to collect path elements from the package_path until the short id has been found. The collected paths can then be used as a suffix of the git cloned sources.

build fails because of missing crate

Description: I was trying to use crate2nix for hydra-cli but it fails because it can't find some crates.


  • Expected: The build succeeds as it does with cargo build
  • Actual: The build fails because some crate is missing
  • How to reproduce:
$ git clone https://github.com/nlewo/hydra-cli
$ git checkout test-crate2nix
$ nix-build -A hydra-cli
Error Output
Building src/lib.rs (flate2)                                                                                                                                   
Running rustc --crate-name flate2 src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=4 --edition 2015 -C metadata=0cab654bef -C extra-filename=-0cab65
4bef --cfg feature="miniz_oxide" --cfg feature="rust_backend" --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern crc32fast=/nix/store
/3m24x66k8w7snjsdzsmcgprahqvn5ija-rust_crc32fast-1.2.0/lib/libcrc32fast-093f96a061.rlib --extern libc=/nix/store/fcsgigv8c5d74403ak65r4rpzi834743-rust_libc-0.2
.62/lib/liblibc-68f9c48770.rlib --cap-lints allow --color always 
unpacking sources                                                                                  
unpacking source archive /nix/store/95n075cbnpnm7ys0b3bdkrv8rid5x27n-crossbeam-queue-0.1.2.tar.gz                                         
unpacking sources                                                                    
source root is crossbeam-queue-0.1.2.tar.gz                                                                                                                   
unpacking source archive /nix/store/85p4a11g26c17xwc7v63v1zkp9qq70d9-getrandom-0.1.11.tar.gz 
error[E0463]: can't find crate for `miniz_oxide`                                                           
   --> src/ffi.rs:469:5                                            
    |                                                                                                                                                         
469 |     extern crate miniz_oxide;                                                  
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
patching sources

Git submodules missing / Switch to pkgs.fetchgit

When using a git source for a crate the git submodules are not being fetched. This is a limitation of builtins.fetchGit. By using pkgs.fetchgit one can fetch those but is then required to provide the output hash of the source archive.

In the long run it is probably best to just do something like nix-prefetch-git for all of the git crates and always use pkgs.fetchgit (or even pkgs.fetchFromGitHub where possible).

This would also aid generating expressions that can be built in pure mode. For example on hydra instances.

Compilation issues with tracing - attribute 'feature' missing

I remember seeing something like this before with Carnix, though I'm not sure this is the same thing.

Generated a Cargo.nix and tried to build, but it fails with attribute 'feature' missing, which resolves to the spin crate dependency for tracing.

    "tracing 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)"
      = rec {
        crateName = "tracing";
        version = "0.1.9";
        edition = "2018";
        sha256 = "003dkgx7agd5g5hdmwayi927hzzr8gk0ghh83n4xg83k0x0wcv61";
        authors = [
          "Tokio Contributors <[email protected]>"
        ];
        dependencies = {
          "cfg-if" = "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)";
          "log" = {
            packageId = "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)";
            optional = true;
          };
          "spin" = {
            packageId = "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)";
            target = (!(target."feature" == "std"));
          };
          "tracing-attributes" = "tracing-attributes 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)";
          "tracing-core" = {
            packageId = "tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)";
            usesDefaultFeatures = false;
          };
        };
        features = {
          "default" = [ "std" ];
          "log-always" = [ "log" ];
          "std" = [ "tracing-core/std" ];
        };
        resolvedDefaultFeatures = [ "default" "log" "std" ];
      };

This is the line in particular that it reports:

target = (!(target."feature" == "std"));

nix-info -m

  • system: "x86_64-linux"
  • host os: Linux 5.3.6, NixOS, 19.09.840.8bf142e001b (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3
  • channels(root): "nixos-19.09.840.8bf142e001b, nixos-stable-19.09.789.7952807791d, nixos-unstable-20.03pre196586.b943338ea58, nixos-unstable-small-20.03pre196834.33366cce147, nixpkgs-unstable-20.03pre196811.7818f30cc4b"
  • channels(evanjs): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

crate2nix version: crate2nix 0.6.0-alpha.0

can't build futures-preview with the compat feature

Without the "compat" feature it builds.

crate2nix 0.6.1 (also tested with master, same issue)

deps

[dependencies]
futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] }

default.nix

{ pkgsFn ? import <nixpkgs> }:

let
  mozOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
  crateOverlay = self: super: {
    defaultCrateOverrides = super.defaultCrateOverrides // {
      test-crate2nix = _attrs: {
        buildInputs = with self; [];
      };
    };
  };
  pkgs = pkgsFn { overlays = [ mozOverlay crateOverlay ]; };
  buildRustCrate = pkgs.buildRustCrate.override {
    rustc = pkgs.latest.rustChannels.nightly.rust;
  };
in
  (pkgs.callPackage ./Cargo.nix { inherit buildRustCrate; })

main.rs

fn main() {
    println!("ok");
}

build

❯ nix-build default.nix
trace: root_crate is deprecated since crate2nix 0.4. Please use rootCrate instead.
trace: workspace_members is deprecated in crate2nix 0.4. Please use workspaceMembers instead.
these derivations will be built:
  /nix/store/8dnqvf22snjljh0lg2ddzfdrs4rfsg7m-rust_futures-util-preview-0.3.0-alpha.19.drv
  /nix/store/qc7w2a15139nszffq30j657c86kjnsxy-rust_futures-executor-preview-0.3.0-alpha.19.drv
  /nix/store/gpc6sdxik5fa3xaa1807b9b3mfmnrvx6-rust_futures-preview-0.3.0-alpha.19.drv
  /nix/store/lil53m4arbfq0iywws4xn3jc8786mgf1-rust_test-crate2nix-0.1.0.drv
building '/nix/store/8dnqvf22snjljh0lg2ddzfdrs4rfsg7m-rust_futures-util-preview-0.3.0-alpha.19.drv'...
unpacking sources
unpacking source archive /nix/store/hl7sx1fyz730rg6m5vhbafs2y662vb0r-futures-util-preview-0.3.0-alpha.19.tar.gz
source root is futures-util-preview-0.3.0-alpha.19.tar.gz
patching sources
configuring
building
Building src/lib.rs (futures_util)
Running rustc --crate-name futures_util src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=4 --edition 2018 -C metadata=bb515e6c5b -C extra-filename=-bb515e6c5b --cfg feature="alloc" --cfg feature="channel" --cfg feature="compat" --cfg feature="futures-channel-preview" --cfg feature="futures-core-preview/alloc" --cfg feature="futures-core-preview/std" --cfg feature="futures-io-preview" --cfg feature="futures-sink-preview" --cfg feature="futures_01" --cfg feature="io" --cfg feature="memchr" --cfg feature="sink" --cfg feature="slab" --cfg feature="std" --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern futures_channel=/nix/store/n56bbbia4i6gskgazv5g0cdv5mr1dvjf-rust_futures-channel-preview-0.3.0-alpha.19/lib/libfutures_channel-b463852d05.rlib --extern futures_core=/nix/store/54ackc3z5y3xy6m5zdsrzgf8v8cb76f0-rust_futures-core-preview-0.3.0-alpha.19/lib/libfutures_core-d44a134ac6.rlib --extern futures_io=/nix/store/mj49lgarg8f30cbk7wpfhv7bkhqbacqc-rust_futures-io-preview-0.3.0-alpha.19/lib/libfutures_io-04d6d753fb.rlib --extern futures_sink=/nix/store/01nn9cmicvp75q13zdwh1fbgbcwj5gk4-rust_futures-sink-preview-0.3.0-alpha.19/lib/libfutures_sink-e9750fb7dd.rlib --extern memchr=/nix/store/hfszhpn12gvakbpgsqdmw7kifnv3q5yh-rust_memchr-2.2.1/lib/libmemchr-ed1427d978.rlib --extern pin_utils=/nix/store/qvs9ryxqagqmpin66g1rhpmx1bazzqjb-rust_pin-utils-0.1.0-alpha.4/lib/libpin_utils-f799508eca.rlib --extern slab=/nix/store/0ms1yan0n2dnjl93p9h8lycdphq3hjd6-rust_slab-0.4.2/lib/libslab-d13bd9d52c.rlib --cap-lints allow --color always
error[E0433]: failed to resolve: use of undeclared type or module `futures_01`
 --> src/compat/executor.rs:9:5
  |
9 | use futures_01::future::{Executor as Executor01, ExecuteError as ExecuteError01};
  |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0433]: failed to resolve: use of undeclared type or module `futures_01`
 --> src/compat/compat01as03.rs:1:5
  |
1 | use futures_01::executor::{
  |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0432]: unresolved import `futures_01`
 --> src/compat/executor.rs:8:5
  |
8 | use futures_01::Future as Future01;
  |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0432]: unresolved import `futures_01`
 --> src/compat/compat01as03.rs:5:5
  |
5 | use futures_01::{
  |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0432]: unresolved import `futures_01`
  --> src/compat/compat01as03.rs:10:5
   |
10 | use futures_01::{AsyncSink as AsyncSink01, Sink as Sink01};
   |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0432]: unresolved import `futures_01`
 --> src/compat/compat03as01.rs:1:5
  |
1 | use futures_01::{
  |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0432]: unresolved import `futures_01`
 --> src/compat/compat03as01.rs:6:5
  |
6 | use futures_01::{
  |     ^^^^^^^^^^ use of undeclared type or module `futures_01`

error[E0433]: failed to resolve: use of undeclared type or module `NotifyHandle01`
   --> src/compat/compat01as03.rs:347:18
    |
347 |         unsafe { NotifyHandle01::new(Box::into_raw(ptr)) }
    |                  ^^^^^^^^^^^^^^ use of undeclared type or module `NotifyHandle01`

error[E0405]: cannot find trait `Executor01` in this scope
  --> src/compat/executor.rs:18:32
   |
18 | pub trait Executor01CompatExt: Executor01<Executor01Future> +
   |                                ^^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `Executor01` in this scope
  --> src/compat/executor.rs:51:11
   |
51 | where Ex: Executor01<Executor01Future> + Clone + Send + 'static
   |           ^^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `Executor01` in this scope
  --> src/compat/executor.rs:69:9
   |
69 |     Ex: Executor01<Executor01Future> + Clone + Send + 'static,
   |         ^^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `Executor01` in this scope
  --> src/compat/executor.rs:84:15
   |
84 | impl<Sp, Fut> Executor01<Fut> for Compat<Sp>
   |               ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `ExecuteError01` in this scope
  --> src/compat/executor.rs:89:50
   |
89 |     fn execute(&self, future: Fut) -> Result<(), ExecuteError01<Fut>> {
   |                                                  ^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `Spawn01` in this scope
  --> src/compat/compat01as03.rs:26:23
   |
26 |     pub(crate) inner: Spawn01<T>,
   |                       ^^^^^^^ not found in this scope

error[E0425]: cannot find function `spawn01` in this scope
  --> src/compat/compat01as03.rs:36:20
   |
36 |             inner: spawn01(object),
   |                    ^^^^^^^ not found in this scope

error[E0412]: cannot find type `Spawn01` in this scope
   --> src/compat/compat01as03.rs:186:23
    |
186 |     pub(crate) inner: Spawn01<S>,
    |                       ^^^^^^^ not found in this scope

error[E0425]: cannot find function `spawn01` in this scope
   --> src/compat/compat01as03.rs:199:20
    |
199 |             inner: spawn01(inner),
    |                    ^^^^^^^ not found in this scope

error[E0412]: cannot find type `NotifyHandle01` in this scope
   --> src/compat/compat01as03.rs:343:34
    |
343 | impl From<WakerToHandle<'_>> for NotifyHandle01 {
    |                                  ^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `NotifyHandle01` in this scope
   --> src/compat/compat01as03.rs:344:43
    |
344 |     fn from(handle: WakerToHandle<'_>) -> NotifyHandle01 {
    |                                           ^^^^^^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `Notify01` in this scope
   --> src/compat/compat01as03.rs:351:6
    |
351 | impl Notify01 for NotifyWaker {
    |      ^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `UnsafeNotify01` in this scope
   --> src/compat/compat01as03.rs:357:13
    |
357 | unsafe impl UnsafeNotify01 for NotifyWaker {
    |             ^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `NotifyHandle01` in this scope
   --> src/compat/compat01as03.rs:358:35
    |
358 |     unsafe fn clone_raw(&self) -> NotifyHandle01 {
    |                                   ^^^^^^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `UnsafeNotify01` in this scope
   --> src/compat/compat01as03.rs:363:29
    |
363 |         let ptr: *const dyn UnsafeNotify01 = self;
    |                             ^^^^^^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `UnsafeNotify01` in this scope
   --> src/compat/compat01as03.rs:364:44
    |
364 |         drop(Box::from_raw(ptr as *mut dyn UnsafeNotify01));
    |                                            ^^^^^^^^^^^^^^ not found in this scope

error: aborting due to 24 previous errors

Some errors have detailed explanations: E0405, E0412, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0405`.
builder for '/nix/store/8dnqvf22snjljh0lg2ddzfdrs4rfsg7m-rust_futures-util-preview-0.3.0-alpha.19.drv' failed with exit code 1
cannot build derivation '/nix/store/lil53m4arbfq0iywws4xn3jc8786mgf1-rust_test-crate2nix-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/lil53m4arbfq0iywws4xn3jc8786mgf1-rust_test-crate2nix-0.1.0.drv' failed

❯ nix build -f Cargo.nix rootCrate.build
builder for '/nix/store/vfhpavldx7p87phmwcg2iyd7qfm4mkpf-rust_futures-util-preview-0.3.0-alpha.19.drv' failed with exit code 1; last 10 log lines:
  error[E0405]: cannot find trait `UnsafeNotify01` in this scope
     --> src/compat/compat01as03.rs:364:44
      |
  364 |         drop(Box::from_raw(ptr as *mut dyn UnsafeNotify01));
      |                                            ^^^^^^^^^^^^^^ not found in this scope

  error: aborting due to 24 previous errors

  Some errors have detailed explanations: E0405, E0412, E0425, E0432, E0433.
  For more information about an error, try `rustc --explain E0405`.
cannot build derivation '/nix/store/6wk2jgb3sgx04017vx7g33njgq1653fd-rust_test-crate2nix-0.1.0.drv': 1 dependencies couldn't be built
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/6wk2jgb3sgx04017vx7g33njgq1653fd-rust_test-crate2nix-0.1.0.drv' failed

Use pinned nixpkgs in shell.nix

To prevent cases like #2, I should use a "pinned" nixos version by default in shell.nix. That means that we don't use the same nixpkgs that the individual user has already fetched but a different one. This results in additional downloads but ensures that it "always" works.

remove no-crateBin hack

Currently crate2nix uses a hack to avoid building binary targets for some crates. It constructs an crateBin attribute with the value of [{name = ","; path = ",";}]. buildRustCrate ignored that for a while since it was parsing comma separated pairs of names and paths and thus treated those as empty "lines".

I am currently working on a cleanup/rewrite of the buildRustCrate infrastructure and moved the logic that was previously in bash to the Nix expression. We can now (or once that PR is merged) properly set an empty list if we do not want any binaries to be produces by buildRustCrate.

There is now another hack to support users of previously generated crate2nix expressions: https://github.com/NixOS/nixpkgs/pull/75563/files#diff-8a4eb609f35e1485456f9c5c8ced5848R66-R69

I guess it is very unlikely that we can set a minimal version of nixpkgs for users of crate2nix? I also do not want to carry that hack in nixpkgs for several releases. What is your opinion on this?

PR: NixOS/nixpkgs#75563

rustversion 1.0.2 fails to build with crate2nix

The error looks like this:

builder for '/nix/store/qzmcgmdyl3vhsj3y5gzfc1miqjxmddxn-rust_rustversion-1.0.2.drv' failed with exit code 1; last 10 log lines:
  Building src/lib.rs (rustversion)
  Running rustc --crate-name rustversion src/lib.rs --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=16 --extern proc_macro2=/nix/store/p0aydc61mn5r4nw4l3c3zmpz1cv4dh4d-rust_proc-macro2-1.0.8-lib/lib/libproc_macro2-436ab8affb.rlib --extern quote=/nix/store/18vbqj8sj4dpnrr7dm19l2vaiail59y6-rust_quote-1.0.2-lib/lib/libquote-3ffc3269a3.rlib --extern syn=/nix/store/2mplqk67f8kfjnl1c2qnmy4md9sz2lf3-rust_syn-1.0.14-lib/lib/libsyn-121d03fbaa.rlib --cfg feature="default" --edition 2018 -C metadata=9fc8a6261b -C extra-filename=-9fc8a6261b --crate-type proc-macro -L /build/rustversion-1.0.2/target/build/rustversion.out --color always
  error: expected one of `!` or `::`, found `{`
   --> src/version.rs:1:9
    |
  1 | Version {
    |         ^ expected one of `!` or `::`

  error: aborting due to previous error

And investigating it looks like src/version.rs is overwritten by the file generated by build.rs. This does not happen with 1.0.1 version or when invoking cargo directly AFAICT.

Prefetch mutliple crates in parallel and/or asynchronously

When running crate2nix generate currently the tool appears to be prefetching the dependencies sequentially and struggles to saturate the bandwidth. Parallelizing (or making it asynchronous scatter-gather) would speed up this tool significantly.

Support renamed crates

The information about package renames is exposed by cargo metadata and should therefore be easy to use. Unfortunately, buildRustCrate has no straight-forward support for this.

User docs for renamed crates.

Help wanted: If someone could make it work by hand-coding a minimalistic nix build file, that would be much appreciated. I think that we can hack our way to success even with the current buildRustCrate but explicit support for crate renames in buildRustCrate would be better. Both is fine for now.

crate2nix ignores crate-type

The Cargo.nix generated by crate2nix does not respect the Cargo.toml field specifying the crate build type. For example, if the Cargo.toml contains the following information:

[lib]
crate-type = ["rlib", "staticlib"]

There will be no difference in the Cargo.nix output that reflects our desire to build a statically linkable library. Furthermore, the rustc command executed by buildRustCrate will not include the desired flags --crate-type lib --crate-type staticlib.

The rust machinery in nixpkgs already supports this functionality. It just looks like crate2nix does not. I have identified what needs to be added to Cargo.nix in order to change this. A crate set just needs to have the attribute type which is a list containing one or more of the following strings:

bin  lib  rlib  dylib  cdylib  staticlib  proc-macro

If there is no crate-type in the Cargo.toml, then the type attribute of the crate object in Cargo.nix should not exist. I manually added this type attribute with the appropriate values, and my desired output was achieved.

I have no familiarity with how crate2nix works, so I do not think I will be able to make this feature addition. Hopefully this issue provides sufficient information to make this modification to crate2nix.

Stack overflow

Using master (stable version had a missing ref in fetchGit):

jamie@machine:~/materialize$ crate2nix generate 
Generated ./Cargo.nix successfully.
jamie@machine:~/materialize$ nix build -f Cargo.nix workspaceMembers.materialized.build
error: stack overflow (possible infinite recursion)

--show-trace doesn't show a trace.

gdb shows:

#0  0x00007ffff7e68ee7 in nix::ExprSelect::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#1  0x000000000049e3b9 in nix::EvalState::forceValue(nix::Value&, nix::Pos const&) ()
#2  0x00007ffff7e677b4 in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#3  0x00007ffff7e67ae1 in nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#4  0x00007ffff7e67216 in nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#5  0x00007ffff7e693cd in nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#6  0x000000000049e3b9 in nix::EvalState::forceValue(nix::Value&, nix::Pos const&) ()
#7  0x00007ffff7e690f1 in nix::ExprSelect::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#8  0x000000000049e3b9 in nix::EvalState::forceValue(nix::Value&, nix::Pos const&) ()
#9  0x00007ffff7e677b4 in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#10 0x00007ffff7e67ae1 in nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#11 0x00007ffff7e67216 in nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#12 0x00007ffff7e693cd in nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#13 0x000000000049e3b9 in nix::EvalState::forceValue(nix::Value&, nix::Pos const&) ()
#14 0x00007ffff7e690f1 in nix::ExprSelect::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#15 0x000000000049e3b9 in nix::EvalState::forceValue(nix::Value&, nix::Pos const&) ()
#16 0x00007ffff7e677b4 in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#17 0x00007ffff7e67ae1 in nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#18 0x00007ffff7e67216 in nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#19 0x00007ffff7e693cd in nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/zkpr9y1kj88wmizbyz84kcymi6h6ic5m-nix-2.3.1/lib/libnixexpr.so
#20 0x000000000049e3b9 in nix::EvalState::forceValue(nix::Value&, nix::Pos const&) ()
...

nix doesn't have debug symbols so I can't find the actual expr being run.

I threw builtins.trace around in the tera file but nothing jumps out so far.

Unfortunately I can't share the code, but here is the generated Cargo.nix - https://gist.github.com/jamii/5c347263b59292e2d9ae62baffc7685c

Without a proper stack trace I'm not sure how to go about debugging this.

Difference in behaviour of `include_str` in a workspace

Test case is here.

This project compiles with cargo build, but not with crate2nix.

Including files from the same workspace but not the same crate is probably a niche feature (if it even is feature! I don't know if this is intentionally allowed by cargo, or was just forgotten to forbid).

I would understand a choice not to support this, but I brought it up anyway in case you want to fix all differences from the build process of cargo.

reqwest-0.10.0 native_tls_crate not found

For some reason we fail to build reqwest-0.10.0 with the following error.

$ nix-build -A reqwest
these derivations will be built:
  /nix/store/chndfc9rs3zbxcka8cc557l2czgk0pnd-rust_reqwest-0.10.0.drv
  /nix/store/mr4b5yg3y1zb8hn249izjwz7axy6drfg-rust_c2nix-reqwest-0.1.0.drv
building '/nix/store/chndfc9rs3zbxcka8cc557l2czgk0pnd-rust_reqwest-0.10.0.drv'...
unpacking sources
unpacking source archive /nix/store/qkr2c2yvlid23a83yk45kmmjmrgxvfv2-reqwest-0.10.0.tar.gz
source root is reqwest-0.10.0
setting SOURCE_DATE_EPOCH to timestamp 1577730381 of file reqwest-0.10.0/Cargo.toml
patching sources
configuring
building
Building src/lib.rs (reqwest)
Running rustc --crate-name reqwest src/lib.rs --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=8 --extern base64=/nix/store/x7jafx876ai6094fm0dzpihanwrna5id-rust_base64-0.11.0-lib/lib/libbase64-072630678c.rlib --extern bytes=/nix/store/39hc1mb8fmlgf4
kxj63cni41lylqnb38-rust_bytes-0.5.3-lib/lib/libbytes-f73f885952.rlib --extern encoding_rs=/nix/store/7aknr8l90a2q6bz8wzxfknl30jdqkc1j-rust_encoding_rs-0.8.22-lib/lib/libencoding_rs-b17d0b6c7b.rlib --extern futures_core=/nix/store/vl08y9432b4cp1j07f79xpbqx61ww8dn-rust_futures-core-0.3.1-lib/lib/libfutures_core-857dc662
e2.rlib --extern futures_util=/nix/store/gli5vv0zjgkzwjyblv40aw8i7v66765r-rust_futures-util-0.3.1-lib/lib/libfutures_util-cb7c926876.rlib --extern http=/nix/store/h9cpmiyy4x4ksji0g9rbgrjffr9ihmnn-rust_http-0.2.0-lib/lib/libhttp-b50d8ba548.rlib --extern http_body=/nix/store/npcmn2fa1y6p2yly12h3jhlwmp61022z-rust_http-bo
dy-0.3.1-lib/lib/libhttp_body-284aab6c33.rlib --extern hyper=/nix/store/7k3nkwszf50a13qrxz7m2s7kr20qwr5k-rust_hyper-0.13.1-lib/lib/libhyper-1b7d7812b6.rlib --extern hyper_tls=/nix/store/6vhrih9z076zz6y0sdvgadxys1c0cgkk-rust_hyper-tls-0.4.0-lib/lib/libhyper_tls-b5fe24eba3.rlib --extern lazy_static=/nix/store/vixvw26wxb
mv92yhi9ksv4sxp9fkciqc-rust_lazy_static-1.4.0-lib/lib/liblazy_static-28e1bf1896.rlib --extern log=/nix/store/hvv6bj1aabyh2gyx7pn1z9pyvz0vklvk-rust_log-0.4.8-lib/lib/liblog-b1c5c93ca2.rlib --extern mime=/nix/store/0mml7gm35pgq321k2cigwky2wgfnpw4w-rust_mime-0.3.15-lib/lib/libmime-646e49dbcc.rlib --extern mime_guess=/nix
/store/vi5cj30kzyj9l9r8mwqwp91fmnyqy11i-rust_mime_guess-2.0.1-lib/lib/libmime_guess-6aa1218eeb.rlib --extern percent_encoding=/nix/store/jpdq03lsg0lfl8scbzhilff4r9a1xnkp-rust_percent-encoding-2.1.0-lib/lib/libpercent_encoding-162836dfd5.rlib --extern pin_project_lite=/nix/store/04n3yk0lawm9alfpn3my37s9slya90dv-rust_pi
n-project-lite-0.1.2-lib/lib/libpin_project_lite-3e6d52a4e8.rlib --extern serde=/nix/store/ikah92sbxzijlg3l8lazz34s395nlbj6-rust_serde-1.0.104-lib/lib/libserde-f8f832bfc5.rlib --extern serde_json=/nix/store/8f3fk3k6p6acylczzdk3vc4zwplrygzd-rust_serde_json-1.0.44-lib/lib/libserde_json-aa79c7c1bf.rlib --extern serde_url
encoded=/nix/store/lchfbic3lh38gkdjs2q8rcxnivbmi8rg-rust_serde_urlencoded-0.6.1-lib/lib/libserde_urlencoded-244bbb741c.rlib --extern time=/nix/store/kkp22brma6ab1v8wl8zchqlhxlzlhs5a-rust_time-0.1.42-lib/lib/libtime-d5aad28549.rlib --extern tokio=/nix/store/9wqjx42f9aqxw9i3prczfninigflgzgq-rust_tokio-0.2.6-lib/lib/libt
okio-cac0becf00.rlib --extern tokio_tls=/nix/store/5paxl4lwxhv2a47pbaw6crnkg96j3kwl-rust_tokio-tls-0.3.0-lib/lib/libtokio_tls-7fe734d4f7.rlib --extern url=/nix/store/nnaddhg9g57npg44kd3hjw6ssh3ia8kp-rust_url-2.1.0-lib/lib/liburl-c895737533.rlib --cfg feature="__tls" --cfg feature="blocking" --cfg feature="default" --c
fg feature="default-tls" --cfg feature="futures-util/io" --cfg feature="hyper-tls" --cfg feature="json" --cfg feature="native-tls-crate" --cfg feature="serde_json" --cfg feature="tokio-tls" --cfg feature="tokio/rt-core" --cfg feature="tokio/rt-threaded" --cfg feature="tokio/sync" --edition 2018 -C metadata=c817bbaedd 
-C extra-filename=-c817bbaedd --crate-type lib -L native=/nix/store/kra6g7g1wz6dvnj1b5j3dhsvfgxz32zp-openssl-1.1.1d/lib -l crypto -l ssl --color always
error[E0432]: unresolved import `native_tls_crate`
  --> src/async_impl/client.rs:18:5
   |
18 | use native_tls_crate::TlsConnector;
   |     ^^^^^^^^^^^^^^^^ use of undeclared type or module `native_tls_crate`

error[E0432]: unresolved import `native_tls_crate`
 --> src/connect.rs:7:5
  |
7 | use native_tls_crate::{TlsConnector, TlsConnectorBuilder};
  |     ^^^^^^^^^^^^^^^^ use of undeclared type or module `native_tls_crate`

error[E0433]: failed to resolve: use of undeclared type or module `native_tls_crate`
  --> src/tls.rs:11:13
   |
11 |     native: native_tls_crate::Certificate,
   |             ^^^^^^^^^^^^^^^^ use of undeclared type or module `native_tls_crate`

error[E0433]: failed to resolve: use of undeclared type or module `native_tls_crate`
  --> src/tls.rs:62:21
   |
62 |             native: native_tls_crate::Certificate::from_der(der).map_err(crate::error::builder)?,
   |                     ^^^^^^^^^^^^^^^^ use of undeclared type or module `native_tls_crate`

error[E0433]: failed to resolve: use of undeclared type or module `native_tls_crate`
  --> src/tls.rs:87:21
   |
87 |             native: native_tls_crate::Certificate::from_pem(pem).map_err(crate::error::builder)?,
   |                     ^^^^^^^^^^^^^^^^ use of undeclared type or module `native_tls_crate`

error[E0433]: failed to resolve: use of undeclared type or module `native_tls_crate`
  --> src/tls.rs:94:53
   |
94 |     pub(crate) fn add_to_native_tls(self, tls: &mut native_tls_crate::TlsConnectorBuilder) {
   |                                                     ^^^^^^^^^^^^^^^^ use of undeclared type or module `native_tls_crate`

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
builder for '/nix/store/chndfc9rs3zbxcka8cc557l2czgk0pnd-rust_reqwest-0.10.0.drv' failed with exit code 1
cannot build derivation '/nix/store/mr4b5yg3y1zb8hn249izjwz7axy6drfg-rust_c2nix-reqwest-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/mr4b5yg3y1zb8hn249izjwz7axy6drfg-rust_c2nix-reqwest-0.1.0.drv' failed

It smells like we are not properly renaming a crate to native_tls_crate.

I crated a minimal test example here: https://github.com/andir/crate2nix-issues/tree/bcdc48383c091692865eff693166feb6749bdd96

dbus_codegen: extern location for dbus_codegen does not exist

As mentioned in #51 (comment):

When attempting to import dbus_codegen, I get some strange errors.

Here is a minimal reproducible example for this issue

# Cargo.toml

[package]
name = "hello-from-generated-code"
version = "0.1.0"
authors = ["[email protected]"]
build = "src/build.rs"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dbus = { git = "https://github.com/diwic/dbus-rs/" }

[build-dependencies]
dbus-codegen = { git = "https://github.com/diwic/dbus-rs/" }
// src/build.rs
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;

use dbus_codegen;

fn main() {
    let out_dir = env::var("OUT_DIR").unwrap();
    let dest_path = Path::new(&out_dir).join("hello.rs");
    let mut f = File::create(&dest_path).unwrap();

    f.write_all(
        b"
        pub fn message() -> &'static str {
            \"Hello, World!\"
        }
    ",
    )
    .unwrap();
}
// src/main.rs

include!(concat!(env!("OUT_DIR"), "/build.rs"));

fn main() {
    println!("{}", message());
}

This is basically the same source that is presented on https://doc.rust-lang.org/cargo/reference/build-scripts.html#case-study-code-generation, with the addition of use dbus_codegen; to build.rs.

Here is the sort of error message I am getting:

rust_crate2nix> unpacking sources
rust_crate2nix> unpacking source archive /nix/store/l9clysw4na0mb84i9525cyrhg2ams3yn-crate2nix-51rust_crate2nix> source root is crate2nix-51rust_crate2nix> patching sources
rust_crate2nix> configuring
rust_crate2nix> Building src/build.rs (crate2nix-51)
rust_crate2nix> Running rustc --crate-name build_script_build src/build.rs --crate-type bin -C opt-level=3 -C codegen-units=8 --edition 2018 --cfg feature="default" --out-dir target/build/crate2nix-51 --emit=dep-info,link -L dependency=target/buildDeps --extern dbus_codegen=/nix/store/w89xkakvva5mz8zmp85v35hvdl0l3jq1-rust_dbus-codegen-0.4.1/lib/libdbus_codegen-6c8a034000.rlib --cap-lints allow --color always
rust_crate2nix> error: extern location for dbus_codegen does not exist: /nix/store/w89xkakvva5mz8zmp85v35hvdl0l3jq1-rust_dbus-codegen-0.4.1/lib/libdbus_codegen-6c8a034000.rlib
rust_crate2nix> error[E0463]: can't find crate for `dbus_codegen`
rust_crate2nix>  --> src/build.rs:3:5
rust_crate2nix>   |
rust_crate2nix> 3 | use dbus_codegen;rust_crate2nix>   |     ^^^^^^^^^^^^ can't find craterust_crate2nix> error: aborting due to 2 previous errors
rust_crate2nix> For more information about this error, try `rustc --explain E0463`.
builder for '/nix/store/7izm2fi5xvlspv73srvsnanm8iksf9ss-rust_crate2nix-51-0.1.0.drv' failed with exit code 1; last 10 log lines:
  
  error[E0463]: can't find crate for `dbus_codegen`
   --> src/build.rs:3:5
    |
  3 | use dbus_codegen;
    |     ^^^^^^^^^^^^ can't find crate
  
  error: aborting due to 2 previous errors
  
  For more information about this error, try `rustc --explain E0463`.
[0 built (1 failed)]
error: build of '/nix/store/7izm2fi5xvlspv73srvsnanm8iksf9ss-rust_crate2nix-51-0.1.0.drv' failed

This error seems to be slightly different from that mentioned in #51 (comment).

Publish to a Binary Cache

Building crate2nix can take really long. It would be cool, to offer a binary cache from which users can pull the precompiled nix package.

If you are OK with using GitHub Actions instead of Travis for your CI, you could use the cachix action to build an publish the package to a binary cache: https://github.com/cachix/cachix-action

Supporting wasm-pack

I'm trying to package https://github.com/input-output-hk/js-chain-libs which requires that I run wasm-pack build and wasm-pack pack inside the derivation.

It seems like wasm-pack invokes cargo build --lib --release --target wasm32-unknown-unknown, which then tries to fetch dependencies from crates.io.

You can find my code at: https://gist.github.com/manveru/6358ae1d4c00bbf0dd0d94a88bd098a2
I'd really appreciate any hints of how to make cargo find the dependencies in the derivation, given that I can't invoke cargo build or rustc directly.

Cannot generate the `with_problematic_crates` Cargo.nix sample

I'm trying to (re)generate the Cargo.nix file from the sample project with_problematic_crates but my crate2nix doesn't generate the same file (libPath attributes are missing for instance)

Here are the commands I executed:

[lewo@tilia:~/repos/crate2nix]$ git log -n1 --oneline 
277fe73 (HEAD -> master, origin/master) Fix #23 - Move integration tests into nix

[lewo@tilia:~/repos/crate2nix]$ nix-shell
crate2nix 0.6.0-alpha.0
Peter Kolloch <[email protected]>
Nix build file generator for a cargo rust projects.

USAGE:
    crate2nix <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    completions    Generate auto-completions for the shell.
    generate       Generate a nix file from a cargo rust project.
    help           Prints this message or the help of the given subcommand(s)

[nix-shell:~/repos/crate2nix]$ crate2nix "generate" "-f" "sample_projects/with_problematic_crates/Cargo.toml" "-o" "sample_projects/with_problematic_crates/Cargo.nix"
Generated sample_projects/with_problematic_crates/Cargo.nix successfully.

[nix-shell:~/repos/crate2nix]$ git diff -- sample_projects/with_problematic_crates/Cargo.nix | grep libPath
-        libPath = "cloudabi.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "index_tests.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "lib.rs";
-        libPath = "src/untrusted.rs";

[nix-shell:~/repos/crate2nix]$ 

The Cargo.nix file I generated: nlewo@047ae1d#diff-d44232a1e2e6e2b12c8e1ef2226078bc

Did I miss something or is it an real issue?

Dependencies enabled by features don't appear to work

I'm trying to package Plume with SQLite for NixOS. I'm using the master branch of crate2nix. This involves disabling the default features and enabling a "sqlite" feature when building. Unfortunately, I get this when I override rootFeatures to be [ "sqlite" ]:

Building src/lib.rs (diesel)
Running rustc --crate-name diesel src/lib.rs --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=2 --extern byteorder=/nix/store/xqnw4v9hx0zs6l2zl8y5m2dh7zd89pk1-rust_byteorder-1.3.1-lib/lib/libbyteorder-87d2e6ee33.rlib --extern chrono=/nix/store/3n27wrv96bid2sqd2h16izjc9l407ql1-rust_chrono-0.4.7-lib/lib/libchrono-f10bc22457.rlib --extern diesel_derives=/nix/store/avdwdilbck1264zzr8n589r3azn5b74p-rust_diesel_derives-1.4.0-lib/lib/libdiesel_derives-5ff800f449.so --extern r2d2=/nix/store/yfgzfik6ap7wrja09vh6wjlj678avlq8-rust_r2d2-0.8.4-lib/lib/libr2d2-f2ff8db6b6.rlib --cfg feature="32-column-tables" --cfg feature="chrono" --cfg feature="default" --cfg feature="diesel_derives/sqlite" --cfg feature="libsqlite3-sys" --cfg feature="r2d2" --cfg feature="sqlite" --cfg feature="with-deprecated" --edition 2015 -C metadata=7365896b5e -C extra-filename=-7365896b5e --crate-type lib --color always
error[E0463]: can't find crate for `ffi`
 --> src/sqlite/connection/mod.rs:1:1
  |
1 | extern crate libsqlite3_sys as ffi;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

There is no reference to libsqlite3_sys in my Cargo.nix, however there is a reference in Cargo.lock. Any ideas?

Git depenency only work for default (master) branch

When using a git source (e.g. from a fork of an upstream repository because your changes haven't been merged yet) builds done with crate2nix fail since they can't find the git dependency.

This might not really be a bug in crate2nix but rather in builtins.fetchGit. As it turned out I can fetch the revision from my fork as soon as the commit is in the default (master) branch.

I did expect crate2nix to prefetch the repository and the respective commit while generating the Cargo.nix file.

Failing to build css_parser

Copied from #4:

@kolloch it does appear to have solved the problem for the test repo, but for my own project, https://github.com/nuxeh/url-bot-rs, there's still the following error, this time for cssparser:

Building src/lib.rs (cssparser)
Running rustc --crate-name cssparser src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=4 --edition 2015 -C metadata=15b8375349 -C extra-filename=-15b8375349 --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern cssparser_macros=/nix/store/8yl9hhivlcpr1q485d9h9kywwlxiia91-rust_cssparser-macros-0.3.5/lib/libcssparser_macros-57e42b786a.so --extern dtoa_short=/nix/store/4v891ffdrzxa2yv547mn3dcdc7iqvak0-rust_dtoa-short-0.3.2/lib/libdtoa_short-77d68b4a44.rlib --extern itoa=/nix/store/adhj88qqyin8zf9bd10xqv1dsizv3bhr-rust_itoa-0.4.3/lib/libitoa-a6f76c7f27.rlib --extern matches=/nix/store/j3laann65lzck6lyg9bpjk7gjw9ihk2k-rust_matches-0.1.8/lib/libmatches-47ddbc585f.rlib --extern phf=/nix/store/qcvaa9ya6vgcrpmmyiq042a8jpb4niid-rust_phf-0.7.24/lib/libphf-95b8a51ebb.rlib --extern procedural_masquerade=/nix/store/rwzpk2qq99bkvr83hckj8akf6xq84dfy-rust_procedural-masquerade-0.1.6/lib/libprocedural_masquerade-e6f18a276f.rlib --extern smallvec=/nix/store/nh1i2602n3nphcrxmznrjbnvmpn747iq-rust_smallvec-0.6.9/lib/libsmallvec-99bacd0cdd.rlib --cap-lints allow -L /build/cssparser-0.24.1.tar.gz/target/build/cssparser.out --cfg rustc_has_pr45225 --color always
error: extern location for cssparser_macros does not exist: /nix/store/8yl9hhivlcpr1q485d9h9kywwlxiia91-rust_cssparser-macros-0.3.5/lib/libcssparser_macros-57e42b786a.so

error[E0463]: can't find crate for cssparser_macros
--> src/lib.rs:73:14
|
73 | #[macro_use] extern crate cssparser_macros;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try rustc --explain E0463.
builder for '/nix/store/dj2mwhaqg6yma100xscp0rx0s43h7zi8-rust_cssparser-0.24.1.drv' failed with exit code 1
cannot build derivation '/nix/store/378wm523mf1mscvbqc7vjhvy8n3hmdj8-rust_url-bot-rs-0.2.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/378wm523mf1mscvbqc7vjhvy8n3hmdj8-rust_url-bot-rs-0.2.0.drv' failed
So as far as i can tell, not out of the woods yet.

Thanks for looking at this, i'll certainly report anything else i find :)

Hmm, cssparser-macros seems to be a sub-crate within cssparser, I wonder if that has anything to do with this.

I can't imagine that that's uncommon, but it looks slightly suspicious for a normal Cargo project to me, just lib.rs and Cargo.toml.

https://github.com/servo/rust-cssparser/tree/master/macros

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.