rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.67k stars 2.41k forks source link

Cannot install cargo-generate #10602

Closed ikramansari77 closed 2 years ago

ikramansari77 commented 2 years ago

Problem

I am installing cargo on windows 10 with WSL2 and cargo-generate installation exits with an error

error: `MaybeUninit::<T>::assume_init` is not yet stable as a const fn
   --> /home/ikram/.cargo/registry/src/github.com-1ecc6299db9ec823/kstring-2.0.0/src/string.rs:844:17
    |
844 |                 std::mem::MaybeUninit::uninit().assume_init()
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `kstring` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-generate v0.13.1`, intermediate artifacts can be found at `/tmp/cargo-installGL2L7R`

Caused by:
  build failed

What's the issue here and how can it be fixed?

Full logs:

Updating crates.io index
  Installing cargo-generate v0.13.1
   Compiling libc v0.2.124
   Compiling proc-macro2 v1.0.37
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.91
   Compiling memchr v2.4.1
   Compiling autocfg v1.1.0
   Compiling version_check v0.9.4
   Compiling cfg-if v1.0.0
   Compiling pkg-config v0.3.25
   Compiling once_cell v1.10.0
   Compiling regex-syntax v0.6.25
   Compiling serde_derive v1.0.136
   Compiling proc-macro-hack v0.5.19
   Compiling serde v1.0.136
   Compiling ucd-trie v0.1.3
   Compiling unicode-width v0.1.9
   Compiling static_assertions v1.1.0
   Compiling maplit v1.0.2
   Compiling log v0.4.16
   Compiling tinyvec_macros v0.1.0
   Compiling gimli v0.26.1
   Compiling failure_derive v0.1.8
   Compiling adler v1.0.2
   Compiling percent-encoding v2.1.0
   Compiling lazy_static v1.4.0
   Compiling matches v0.1.9
   Compiling either v1.6.1
   Compiling time-macros v0.2.4
   Compiling rustc-demangle v0.1.21
   Compiling itoa v1.0.1
   Compiling bitflags v1.3.2
   Compiling num_threads v0.1.5
   Compiling unicode-bidi v0.3.7
   Compiling quick-error v2.0.1
   Compiling hex v0.4.3
   Compiling unicode-segmentation v1.9.0
   Compiling anymap2 v0.13.0
   Compiling doc-comment v0.3.3
   Compiling crossbeam-utils v0.8.8
   Compiling strsim v0.8.0
   Compiling remove_dir_all v0.5.3
   Compiling anyhow v1.0.57
   Compiling semver v1.0.7
   Compiling fnv v1.0.7
   Compiling same-file v1.0.6
   Compiling vec_map v0.8.2
   Compiling minimal-lexical v0.2.1
   Compiling fastrand v1.7.0
   Compiling ansi_term v0.12.1
   Compiling openssl-probe v0.1.5
   Compiling number_prefix v0.4.0
   Compiling unicode-bom v1.1.4
   Compiling smallvec v1.8.0
   Compiling zeroize v1.5.4
   Compiling home v0.5.3
   Compiling heck v0.4.0
   Compiling tinyvec v1.6.0
   Compiling textwrap v0.11.0
   Compiling miniz_oxide v0.5.1
   Compiling thread_local v1.1.4
   Compiling path-dedot v3.0.17
   Compiling pest v2.1.3
   Compiling form_urlencoded v1.0.1
   Compiling itertools v0.10.3
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling ahash v0.7.6
   Compiling num-traits v0.2.14
   Compiling smartstring v1.0.1
   Compiling walkdir v2.3.2
   Compiling git-hash v0.9.3
   Compiling heck v0.3.3
   Compiling path-absolutize v3.0.13
   Compiling unicode-normalization v0.1.19
   Compiling aho-corasick v0.7.18
   Compiling object v0.28.3
   Compiling bstr v0.2.17
   Compiling nom v7.1.1
   Compiling quote v1.0.18
   Compiling pest_meta v2.1.3
   Compiling terminal_size v0.1.17
   Compiling time v0.3.9
   Compiling atty v0.2.14
   Compiling dirs-sys v0.3.7
   Compiling getrandom v0.2.6
   Compiling git-features v0.20.0
   Compiling tempfile v3.3.0
   Compiling remove_dir_all v0.7.0
   Compiling jobserver v0.1.24
   Compiling clap v2.34.0
   Compiling dirs v4.0.0
   Compiling cc v1.0.73
   Compiling proc-quote-impl v0.3.2
   Compiling regex v1.5.5
   Compiling idna v0.2.3
   Compiling addr2line v0.17.0
   Compiling libz-sys v1.1.5
   Compiling openssl-sys v0.9.72
   Compiling libssh2-sys v0.2.23
   Compiling backtrace v0.3.65
   Compiling libgit2-sys v0.13.2+1.4.2
   Compiling url v2.2.2
   Compiling console v0.15.0
   Compiling globset v0.4.8
   Compiling sanitize-filename v0.3.0
   Compiling ignore v0.4.18
   Compiling dialoguer v0.10.0
   Compiling indicatif v0.16.2
   Compiling synstructure v0.12.6
   Compiling pest_generator v2.1.3
   Compiling proc-quote v0.4.0
   Compiling pest_derive v2.1.0
   Compiling liquid-derive v0.26.0
   Compiling structopt-derive v0.4.18
   Compiling rhai_codegen v1.4.0
   Compiling thiserror-impl v1.0.30
   Compiling failure v0.1.8
   Compiling pwd v1.3.1
   Compiling rhai v1.6.1
   Compiling git-config v0.2.1
   Compiling structopt v0.3.26
   Compiling thiserror v1.0.30
   Compiling git2 v0.14.2
   Compiling kstring v2.0.0
   Compiling toml v0.5.9
error: `MaybeUninit::<T>::assume_init` is not yet stable as a const fn
   --> /home/ikram/.cargo/registry/src/github.com-1ecc6299db9ec823/kstring-2.0.0/src/string.rs:844:17
    |
844 |                 std::mem::MaybeUninit::uninit().assume_init()
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `kstring` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-generate v0.13.1`, intermediate artifacts can be found at `/tmp/cargo-installGL2L7R`

Caused by:
  build failed

Steps

  1. Install cargo
  2. Then run this command cargo install cargo-generate

Possible Solution(s)

No response

Notes

No response

Version

No response

epage commented 2 years ago

FYI cargo-generate is a separate project, see https://github.com/cargo-generate/cargo-generate

This problem specifically looks like its an issue with using too old of a Rust version.

As this isn't an issue with cargo, I'm going to go ahead and close. If there is something I missed though, let us know!

Eh2406 commented 2 years ago

Maybe try a newer version of Cargo? I don't know if it will help. You left the Version section blank.

assume_init was stabilized in 1.59

ikramansari77 commented 2 years ago

Actually it worked with the latest version cargo v1.60.0