Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitx-credentials fails to build #1522

Closed
adapt-L opened this issue Aug 13, 2024 · 4 comments
Closed

gitx-credentials fails to build #1522

adapt-L opened this issue Aug 13, 2024 · 4 comments

Comments

@adapt-L
Copy link

adapt-L commented Aug 13, 2024

Current behavior 😯

it appears that gitoxide gets pulled in as a dependency of a package I'm using called cargo-espflash. gix-credentials fails to build apparently due to a lack of "type annotations". Here is the error it gives me:

error[E0283]: type annotations needed
  --> /home/adam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-credentials-0.23.1/src/program/mod.rs:83:63
   |
83 |                 gix_command::prepare(gix_path::from_bstr(args.as_ref()).into_owned())
   |                                                               ^^^^^^
   |
   = note: multiple `impl`s satisfying `BString: AsRef<_>` found in the `bstr` crate:
           - impl AsRef<BStr> for BString;
           - impl AsRef<[u8]> for BString;
help: try using a fully qualified path to specify the expected types
   |
83 |                 gix_command::prepare(gix_path::from_bstr(<BString as AsRef<T>>::as_ref(&args)).into_owned())
   |                                                          +++++++++++++++++++++++++++++++    ~

error[E0283]: type annotations needed
   --> /home/adam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-credentials-0.23.1/src/program/mod.rs:83:38
    |
83  |                 gix_command::prepare(gix_path::from_bstr(args.as_ref()).into_owned())
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for reference `&_`
    |
    = note: multiple `impl`s satisfying `Cow<'_, BStr>: From<&_>` found in the `bstr` crate:
            - impl<'a> From<&'a BStr> for Cow<'a, BStr>;
            - impl<'a> From<&'a BString> for Cow<'a, BStr>;
    = note: required for `&_` to implement `Into<Cow<'_, BStr>>`
note: required by a bound in `from_bstr`
   --> /home/adam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-path-0.10.9/src/convert.rs:135:34
    |
135 | pub fn from_bstr<'a>(input: impl Into<Cow<'a, BStr>>) -> Cow<'a, Path> {
    |                                  ^^^^^^^^^^^^^^^^^^^ required by this bound in `from_bstr`

Expected behavior 🤔

it should com

Git behavior

No response

Steps to reproduce 🕹

cargo install cargo-espflash

@adapt-L
Copy link
Author

adapt-L commented Aug 14, 2024

nevermind, i've tracked down the bug elsewhere

@adapt-L adapt-L closed this as completed Aug 14, 2024
@shymega
Copy link

shymega commented Aug 15, 2024

Please state the workaround - I'm experiencing this too, and I have no idea what fixed it for you. If you share, everyone can benefit.

@Byron
Copy link
Member

Byron commented Aug 15, 2024

cargo update should do the trick.

@adapt-L
Copy link
Author

adapt-L commented Aug 15, 2024

@shymega You're right, I should have stated my solution here. I was unsure if it was worth posting to a gitoxide bug tracker because this bug appeared to be more related to cargo-espflash and was fixed in patch request on their software here: esp-rs/espflash#659 , See also esp-rs/espflash#658

Here is what I did to compile a working version of cargo-espflash:

git clone https://github.com/esp-rs/espflash.git
cargo install --path espflash/cargo-espflash --locked
cargo install --path espflash/espflash --locked

The --path argument forces cargo to install from a certain path (in my case the package directory of the latest/master branch of espflash workspace). The --locked is necessary for cargo to actually respect the Cargo.lock files (which control the dependency versions affected in the patch). Took me a couple tries to figure this out (It's surprising that this behavior has to be specified manually with cargo, the integration with crates.io is way too deep in the rust ecosystem)

That all being said, I think they recently released a new version of cargo-espflash on crates.io or whatever it's called, so it's not necessary to build from the master branch as @Byron says.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants