GitoxideLabs / gitoxide

An idiomatic, lean, fast & safe pure Rust implementation of Git
Apache License 2.0
8.91k stars 303 forks source link

Build error #1597

Closed jdiez17 closed 3 weeks ago

jdiez17 commented 3 weeks ago

Current behavior 😯

cargo install --git https://github.com/jaskij/cargo-bitbake.git (which transitively depends on gix-path) fails to build:

error[E0283]: type annotations needed
  --> /home/rosdev/.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/rosdev/.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/rosdev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-path-0.10.11/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 🤔

Build is successful

Git behavior

N/A

Steps to reproduce 🕹

cargo install --git https://github.com/jaskij/cargo-bitbake.git

Byron commented 3 weeks ago

Thanks for reporting!

Does it work with —locked?

NoelJacob commented 3 weeks ago

I got it too with a tool having it as dependency

jdiez17 commented 3 weeks ago

Thanks for the fast reply! I haven't tried with --locked, but what fixed it for me was updating the git2 dependency from 0.18.3 to 0.19.0. Still, it may be that there's a bug in the gitoxide version that git2@0.18.3 depends.

Skgland commented 3 weeks ago

I think this might be related to https://github.com/Byron/gitoxide/issues/1466 https://github.com/Byron/gitoxide/issues/1467

Byron commented 3 weeks ago

I am glad it works now!

Unfortunately these build issues occor from time to time and one may hope that it will the chance of this will decrease over time.

Meanwhile, I think there is nothing left to be done here, so I am closing the issue. Please feel free to keep posting if anything new comes up.