dtolnay/cargo-expand

Cargo install cargo-expand failed

g302ge opened this issue · 2 comments

I directly installed the cargo-expand use the command :

cargo install cargo-expand 

But I got this error when compiling it , my rust toolchain version is rustc 1.58.0-nightly (65f3f8b22 2021-11-21)

error[E0277]: cannot add `&()` to `usize`
  --> /Users/oker/.cargo/registry/src/github.com-1ecc6299db9ec823/bat-0.19.0/src/line_range.rs:56:37
   |
56 |                     new_range.lower + more_lines
   |                                     ^ no implementation for `usize + &()`
   |
   = help: the trait `Add<&()>` is not implemented for `usize`

error[E0277]: the trait bound `(): FromStr` is not satisfied
    --> /Users/oker/.cargo/registry/src/github.com-1ecc6299db9ec823/bat-0.19.0/src/line_range.rs:54:26
     |
54   |                         .parse()
     |                          ^^^^^ the trait `FromStr` is not implemented for `()`
     |
note: required by a bound in `core::str::<impl str>::parse`
    --> /Users/oker/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/str/mod.rs:2247:21
     |
2247 |     pub fn parse<F: FromStr>(&self) -> Result<F, F::Err> {
     |                     ^^^^^^^ required by this bound in `core::str::<impl str>::parse`

That nightly is broken. You'll need to use a different one. It doesn't have anything to do with this crate.

I have installed this tool use old version 1.0.12