Cannot install on Rust 1.67
haitrungle opened this issue · comments
Describe the bug
Running cargo install cargo-generate
failed with rustc 1.67.0. Specifically, it fails to build git-ref 0.23.1, which is a dependency of git-config.
Desktop (please complete the following information):
- OS: Windows 10
rustc --version
: 1.67.0
Additional context
The bug is probably caused by gitoxide using bstr incorrectly: Byron/gitoxide#747. A fix has been publish yesterday, I think we just need to update git-config (or gix-config?) to 0.16.3.
Can confirm for rustc 1.67.1 on Manjaro
Confirming too, wasnt able to install it today
Same for me on macos.
error[E0277]: the trait bound `BStr: AsRef<[_; 0]>` is not satisfied
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/store/packed/find.rs:95:35
|
95 | .map(|(_rest, r)| r.name.as_bstr().as_ref())
| ^^^^^^^^^^^^^^^^ ------ required by a bound introduced by this call
| |
| the trait `AsRef<[_; 0]>` is not implemented for `BStr`
|
= help: the following other types implement trait `AsRef<T>`:
<BStr as AsRef<BStr>>
<BStr as AsRef<[u8]>>
error[E0277]: the trait bound `BStr: AsRef<[_; 0]>` is not satisfied
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/store/packed/find.rs:91:33
|
91 | a.binary_search_by_key(&full_name.as_ref(), |b: &u8| {
| ^^^^^^^^^ ------ required by a bound introduced by this call
| |
| the trait `AsRef<[_; 0]>` is not implemented for `BStr`
|
= help: the following other types implement trait `AsRef<T>`:
<BStr as AsRef<BStr>>
<BStr as AsRef<[u8]>>
error[E0283]: type annotations needed
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/fullname.rs:109:43
|
109 | if let Some(shortened) = name.strip_prefix(category.prefix().as_ref()) {
| ^^^^^^^^^^^^ -------------------------- type must be known at this point
| |
| cannot infer type of the type parameter `P` declared on the associated function `strip_prefix`
|
= note: cannot satisfy `_: core::slice::SlicePattern`
note: required by a bound in `core::slice::<impl [T]>::strip_prefix`
--> /Users/l1x/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/mod.rs:2284:28
|
2284 | pub fn strip_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> Option<&[T]>
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::slice::<impl [T]>::strip_prefix`
help: consider specifying the generic argument
|
109 | if let Some(shortened) = name.strip_prefix::<P>(category.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/fullname.rs:109:43
|
109 | if let Some(shortened) = name.strip_prefix(category.prefix().as_ref()) {
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter `P` declared on the associated function `strip_prefix`
|
= note: multiple `impl`s satisfying `BStr: AsRef<_>` found in the `bstr` crate:
- impl AsRef<BStr> for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
109 | if let Some(shortened) = name.strip_prefix::<P>(category.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/fullname.rs:132:46
|
132 | } else if let Some(shortened) = name.strip_prefix(Category::MainPseudoRef.prefix().as_ref()) {
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter `P` declared on the associated function `strip_prefix`
|
= note: multiple `impl`s satisfying `BStr: AsRef<_>` found in the `bstr` crate:
- impl AsRef<BStr> for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
132 | } else if let Some(shortened) = name.strip_prefix::<P>(Category::MainPseudoRef.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/fullname.rs:139:18
|
139 | name.strip_prefix(Category::LinkedPseudoRef { name: "".into() }.prefix().as_ref())
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter `P` declared on the associated function `strip_prefix`
|
= note: multiple `impl`s satisfying `BStr: AsRef<_>` found in the `bstr` crate:
- impl AsRef<BStr> for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
139 | name.strip_prefix::<P>(Category::LinkedPseudoRef { name: "".into() }.prefix().as_ref())
| +++++
error[E0283]: type annotations needed
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/raw.rs:76:18
|
76 | .strip_prefix(namespace.0.as_bstr().as_ref())
| ^^^^^^^^^^^^ ------------------------------ type must be known at this point
| |
| cannot infer type of the type parameter `P` declared on the associated function `strip_prefix`
|
= note: cannot satisfy `_: core::slice::SlicePattern`
note: required by a bound in `core::slice::<impl [T]>::strip_prefix`
--> /Users/l1x/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/mod.rs:2284:28
|
2284 | pub fn strip_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> Option<&[T]>
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::slice::<impl [T]>::strip_prefix`
help: consider specifying the generic argument
|
76 | .strip_prefix::<P>(namespace.0.as_bstr().as_ref())
| +++++
error[E0283]: type annotations needed
--> /Users/l1x/.cargo/registry/src/github.com-1ecc6299db9ec823/git-ref-0.23.1/src/raw.rs:76:18
|
76 | .strip_prefix(namespace.0.as_bstr().as_ref())
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter `P` declared on the associated function `strip_prefix`
|
= note: multiple `impl`s satisfying `BStr: AsRef<_>` found in the `bstr` crate:
- impl AsRef<BStr> for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
76 | .strip_prefix::<P>(namespace.0.as_bstr().as_ref())
| +++++
Some errors have detailed explanations: E0277, E0283.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `git-ref` due to 8 previous errors
warning: build failed, waiting for other jobs to finish...
Btw. I can compile with cargo build when checking out the repo.
Workaround:
- clone this repo
- cargo build --release
- cp target/release/cargo-generate ~/bin/
- use cargo-generate (for exaple: cargo generate --git https://github.com/seed-rs/seed-quickstart.git --name admin)
error[E0277]: the trait bound BStr: AsRef<[_; 0]>
is not satisfied
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\store\packed\find.rs:95:35
|
95 | .map(|(_rest, r)| r.name.as_bstr().as_ref())
| ^^^^^^^^^^^^^^^^ ------ required by a bound introduced by this call
| |
| the trait AsRef<[_; 0]>
is not implemented for BStr
|
= help: the following other types implement trait AsRef<T>
:
<BStr as AsRef>
<BStr as AsRef<[u8]>>
error[E0277]: the trait bound BStr: AsRef<[_; 0]>
is not satisfied
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\store\packed\find.rs:91:33
|
91 | a.binary_search_by_key(&full_name.as_ref(), |b: &u8| {
| ^^^^^^^^^ ------ required by a bound introduced by this call
| |
| the trait AsRef<[_; 0]>
is not implemented for BStr
|
= help: the following other types implement trait AsRef<T>
:
<BStr as AsRef>
<BStr as AsRef<[u8]>>
error[E0283]: type annotations needed
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:109:43
|
109 | if let Some(shortened) = name.strip_prefix(category.prefix().as_ref()) {
| ^^^^^^^^^^^^ -------------------------- type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: cannot satisfy _: core::slice::SlicePattern
note: required by a bound in core::slice::<impl [T]>::strip_prefix
--> C:\Users\User.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\slice\mod.rs:2284:28
|
2284 | pub fn strip_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> Option<&[T]>
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in core::slice::<impl [T]>::strip_prefix
help: consider specifying the generic argument
|
109 | if let Some(shortened) = name.strip_prefix::
(category.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:109:43
|
109 | if let Some(shortened) = name.strip_prefix(category.prefix().as_ref()) {
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
109 | if let Some(shortened) = name.strip_prefix::
(category.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:132:46
|
132 | } else if let Some(shortened) = name.strip_prefix(Category::MainPseudoRef.prefix().as_ref()) {
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
132 | } else if let Some(shortened) = name.strip_prefix::
(Category::MainPseudoRef.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:139:18
|
139 | name.strip_prefix(Category::LinkedPseudoRef { name: "".into() }.prefix().as_ref())
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
139 | name.strip_prefix::
(Category::LinkedPseudoRef { name: "".into() }.prefix().as_ref())
| +++++
error[E0283]: type annotations needed
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\raw.rs:76:18
|
76 | .strip_prefix(namespace.0.as_bstr().as_ref())
| ^^^^^^^^^^^^ ------------------------------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: cannot satisfy _: core::slice::SlicePattern
note: required by a bound in core::slice::<impl [T]>::strip_prefix
--> C:\Users\User.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\slice\mod.rs:2284:28
|
2284 | pub fn strip_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> Option<&[T]>
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in core::slice::<impl [T]>::strip_prefix
help: consider specifying the generic argument
|
76 | .strip_prefix::
(namespace.0.as_bstr().as_ref())
| +++++
error[E0283]: type annotations needed
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\raw.rs:76:18
|
76 | .strip_prefix(namespace.0.as_bstr().as_ref())
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
76 | .strip_prefix::
(namespace.0.as_bstr().as_ref())
| +++++
Some errors have detailed explanations: E0277, E0283.
For more information about an error, try rustc --explain E0277
.
error: could not compile git-ref
due to 8 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile cargo-generate v0.17.6
, intermediate artifacts can be found at C:\Users\User\AppData\Local\Temp\cargo-installH1sfKR
PS C:\Users\User\Desktop\RUST\Rust_The_Complete_Guide> rustc --explain E0277
You tried to use a type which doesn't implement some trait in a place which
expected that trait.
Is this a similar problem? I can not run the[ $cargo install cargo-generate ] command without running into the errors mentioned above.
I've been trying since yesterday with several releases....and they have the same bug:
error[E0277]: the trait bound BStr: AsRef<[_; 0]>
is not satisfied
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\store\packed\find.rs:95:52
|
95 | .map(|(_rest, r)| r.name.as_bstr().as_ref())
| ^^^^^^ the trait AsRef<[_; 0]>
is not implemented for BStr
|
= help: the following other types implement trait AsRef<T>
:
<BStr as AsRef>
<BStr as AsRef<[u8]>>
error[E0277]: the trait bound BStr: AsRef<[_; 0]>
is not satisfied
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\store\packed\find.rs:91:43
|
91 | a.binary_search_by_key(&full_name.as_ref(), |b: &u8| {
| ^^^^^^ the trait AsRef<[_; 0]>
is not implemented for BStr
|
= help: the following other types implement trait AsRef<T>
:
<BStr as AsRef>
<BStr as AsRef<[u8]>>
error[E0283]: type annotations needed
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:109:43
|
109 | if let Some(shortened) = name.strip_prefix(category.prefix().as_ref()) {
| ^^^^^^^^^^^^ -------------------------- type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: cannot satisfy _: core::slice::SlicePattern
= help: the following types implement trait core::slice::SlicePattern
:
[T; N]
[T]
note: required by a bound in core::slice::<impl [T]>::strip_prefix
--> /rustc/5243ea5c29b136137c36bd773e5baa663790e097\library\core\src\slice\mod.rs:2333:5
help: consider specifying the generic argument
|
109 | if let Some(shortened) = name.strip_prefix::
(category.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:109:43
|
109 | if let Some(shortened) = name.strip_prefix(category.prefix().as_ref()) {
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
109 | if let Some(shortened) = name.strip_prefix::
(category.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:132:46
|
132 | } else if let Some(shortened) = name.strip_prefix(Category::MainPseudoRef.prefix().as_ref()) {
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
132 | } else if let Some(shortened) = name.strip_prefix::
(Category::MainPseudoRef.prefix().as_ref()) {
| +++++
error[E0283]: type annotations needed
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\fullname.rs:139:18
|
139 | name.strip_prefix(Category::LinkedPseudoRef { name: "".into() }.prefix().as_ref())
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
139 | name.strip_prefix::
(Category::LinkedPseudoRef { name: "".into() }.prefix().as_ref())
| +++++
error[E0283]: type annotations needed
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\raw.rs:76:18
|
76 | .strip_prefix(namespace.0.as_bstr().as_ref())
| ^^^^^^^^^^^^ ------------------------------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: cannot satisfy _: core::slice::SlicePattern
= help: the following types implement trait core::slice::SlicePattern
:
[T; N]
[T]
note: required by a bound in core::slice::<impl [T]>::strip_prefix
--> /rustc/5243ea5c29b136137c36bd773e5baa663790e097\library\core\src\slice\mod.rs:2333:5
help: consider specifying the generic argument
|
76 | .strip_prefix::
(namespace.0.as_bstr().as_ref())
| +++++
error[E0283]: type annotations needed
--> C:\Users%USERPROFILE%.cargo\registry\src\github.com-1ecc6299db9ec823\git-ref-0.23.1\src\raw.rs:76:18
|
76 | .strip_prefix(namespace.0.as_bstr().as_ref())
| ^^^^^^^^^^^^ ------ type must be known at this point
| |
| cannot infer type of the type parameter P
declared on the associated function strip_prefix
|
= note: multiple impl
s satisfying BStr: AsRef<_>
found in the bstr
crate:
- impl AsRef for BStr;
- impl AsRef<[u8]> for BStr;
help: consider specifying the generic argument
|
76 | .strip_prefix::
(namespace.0.as_bstr().as_ref())
| +++++
Some errors have detailed explanations: E0277, E0283.
For more information about an error, try rustc --explain E0277
.
error: could not compile git-ref
due to 8 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile cargo-generate v0.17.6
, intermediate artifacts can be found at C:\Users\%USERPROFILE%\AppData\Local\Temp\cargo-installS23zY8
For a workaround:
$ cargo install --locked cargo-generate
This is fixed with release v0.18.0 that is now out.