GitoxideLabs / gitoxide

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

gix-object v0.44.0 fail to compile #1538

Closed NobodyXu closed 1 month ago

NobodyXu commented 1 month ago

Current behavior 😯

https://github.com/cargo-bins/simple-git/actions/runs/10517678165/job/29142235436?pr=35

error[E0599]: `(&[u8], impl Parser<_, <_ as Stream>::Slice, _>, &[u8], fn(&mut _) -> Result<..., ...> {rest::<..., ...>})` is not an iterator
  --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-object-0.44.0/src/tag/decode.rs:59:26
   |
53 | /                     (
54 | |                         &PGP_SIGNATURE_BEGIN[1..],
55 | |                         take_until(0.., PGP_SIGNATURE_END),
56 | |                         PGP_SIGNATURE_END,
57 | |                         rest,
58 | |                     )
59 | |                         .take()
   | |                         -^^^^ `(&[u8], impl Parser<_, <_ as Stream>::Slice, _>, &[u8], fn(&mut _) -> Result<..., ...> {rest::<..., ...>})` is not an iterator
   | |_________________________|
   |
   |
   = note: the full type name has been written to '/Users/runner/work/simple-git/simple-git/target/aarch64-apple-darwin/debug/deps/gix_object-976e30f84e72c296.long-type-4190708012872330450.txt'
   = note: consider using `--verbose` to print the full type name to the console
   = note: the full name for the type has been written to '/Users/runner/work/simple-git/simple-git/target/aarch64-apple-darwin/debug/deps/gix_object-976e30f84e72c296.long-type-4190708012872330450.txt'
   = note: consider using `--verbose` to print the full type name to the console
   = note: the following trait bounds were not satisfied:
           `(&[u8], impl winnow::Parser<_, <_ as Stream>::Slice, _>, &'static [u8], for<'a> fn(&'a mut _) -> Result<<_ as Stream>::Slice, ErrMode<_>> {rest::<_, _>}): Iterator`
           which is required by `&mut (&[u8], impl winnow::Parser<_, <_ as Stream>::Slice, _>, &'static [u8], for<'a> fn(&'a mut _) -> Result<<_ as Stream>::Slice, ErrMode<_>> {rest::<_, _>}): Iterator`

error[E0599]: the method `take` exists for tuple `(impl Parser<_, <_ as Stream>::Slice, _>, &[u8], Map<..., ..., ..., ..., ..., ...>)`, but its trait bounds were not satisfied
  --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-object-0.44.0/src/parse.rs:25:14
   |
20 | /         (
21 | |             take_till(1.., NL),
22 | |             NL,
23 | |             repeat(1.., terminated((SPACE, take_until(0.., NL)), NL)).map(|()| ()),
24 | |         )
25 | |             .take()
   | |             -^^^^ method cannot be called due to unsatisfied trait bounds
   | |_____________|
   |
   |
   = note: the full type name has been written to '/Users/runner/work/simple-git/simple-git/target/aarch64-apple-darwin/debug/deps/gix_object-976e30f84e72c296.long-type-16570815735586947285.txt'
   = note: consider using `--verbose` to print the full type name to the console
   = note: the following trait bounds were not satisfied:
           `(impl winnow::Parser<_, <_ as Stream>::Slice, _>, &'static [u8], winnow::combinator::Map<winnow::combinator::Repeat<impl winnow::Parser<_, (_, _), _>, _, (_, _), (), _>, {closure@/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-object-0.44.0/src/parse.rs:23:75: 23:79}, _, (), (), _>): Iterator`
           which is required by `&mut (impl winnow::Parser<_, <_ as Stream>::Slice, _>, &'static [u8], winnow::combinator::Map<winnow::combinator::Repeat<impl winnow::Parser<_, (_, _), _>, _, (_, _), (), _>, {closure@/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gix-object-0.44.0/src/parse.rs:23:75: 23:79}, _, (), (), _>): Iterator`

Expected behavior 🤔

Should compile without error

Git behavior

No response

Steps to reproduce 🕹

No response

Byron commented 1 month ago

I have cloned the simple-git repository and could reproduce the issue after using gix v0.66.

The issue seems to be due to gix assuming a more recent patch-level of winnow, which the repository locks into place.

simple-git ( main) +100 -228 [!] took 7s
❯ cargo update -p winnow
    Updating crates.io index
     Locking 1 package to latest compatible version
    Updating winnow v0.6.13 -> v0.6.18
note: pass `--verbose` to see 79 unchanged dependencies behind latest

simple-git ( main) +102 -230 [!]
❯ cargo check
    Checking winnow v0.6.18
    Checking hyper v1.4.1
    Checking hyper-util v0.1.6
    Checking gix-actor v0.32.0
    Checking reqwest v0.12.5
    Checking gix-object v0.44.0
    Checking gix-transport v0.42.3
    Checking gix-revwalk v0.15.0
    Checking gix-ref v0.47.0
    Checking gix-filter v0.13.0
    Checking gix-pack v0.53.0
    Checking gix-diff v0.46.0
    Checking gix-traverse v0.41.0
    Checking gix-revision v0.29.0
    Checking gix-negotiate v0.15.0
    Checking gix-protocol v0.45.3
    Checking gix-refspec v0.25.0
    Checking gix-index v0.35.0
    Checking gix-config v0.40.0
    Checking gix-discover v0.35.0
    Checking gix-odb v0.63.0
    Checking gix-worktree v0.36.0
    Checking gix-worktree-state v0.13.0
    Checking gix-submodule v0.14.0
    Checking gix v0.66.0
    Checking simple-git v0.2.11 (/Users/byron/dev/github.com/Byron/simple-git)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.42s

simple-git ( main) +102 -230 [!] took 3s

Updating the patch level of winnow in the Cargo.lock file seems to do the trick.

CC @epage

NobodyXu commented 1 month ago

@Byron I think you should bump it in gix?

This is technically still a problem in gix, the older version of winnow should not be selectable, if it is not usable.

@Byron You could use cargo +nightly update -Zminimal-versions in CI to test this, I believe this issue should be re-opened.