Compile of cargo was aborted due to Compile Error

I tried to install cargo-generate so I typed the command below:

cargo install cargo-generate

Then cargo started to download and compile a lot of crates but it was aborted because of compile error.
This is tail of the output..

   Compiling cargo v0.46.1
error[E0283]: type annotations needed
   --> /home/sugi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.46.1/src/cargo/util/config/de.rs:471:63
    |
471 |                 seed.deserialize(Tuple2Deserializer(1i32, env.as_ref()))
    |                                                           ----^^^^^^--
    |                                                           |   |
    |                                                           |   cannot infer type for type parameter `T` declared on the trait `AsRef`
    |                                                           this method call resolves to `&T`
    |
    = note: cannot satisfy `std::string::String: AsRef<_>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
error: failed to compile `cargo-generate v0.5.1`, intermediate artifacts can be found at `/tmp/cargo-installQEj0hM`

Caused by:
  could not compile `cargo`

To learn more, run the command again with --verbose.

It seems to panicked while compiling cargo and I have no idea to fix it.
Can somebody solve this error?

My enviroment is:
OS : Ubuntu 20.04.1 on WSL2 on Windows 10 Home 64bit Insider Preview
rustc: 1.49.0
cargo: 1.49.0

the quote of log is not shown completely in my display because the line is too long so I add my screenshot.

It seems this issue was already reported, in the meantime try installing a locked version cargo install cargo-generate --locked cargo ? (or cargo install cargo-generate --locked serde)

2 Likes

Oh, sorry for overlooking of the issue and late reply.
It has succeeded by your command.
Thank you for your answer.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.