starship: cargo install starship fails with "error[E0308]: mismatched types"
Current Behavior
Unable to install starsip via cargo install
Expected Behavior
Running this command:
cargo install starship
I expect the compilation and installation of starship to work.
Additional context/Screenshots
It seems as if there is an issue with the create git_date - but I am no expert on these matters so I may be wrong.
cargo install starship
Updating crates.io index
Installing starship v1.10.2
Compiling libc v0.2.132
.
.
.
Compiling git-repository v0.21.1
error[E0308]: mismatched types
--> /home/yooakim/.cargo/registry/src/github.com-1ecc6299db9ec823/git-repository-0.21.1/src/repository/identity.rs:19:19
|
19 | time: git_date::Time::now_local_or_utc(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `git_actor::Time`, found struct `git_date::Time`
|
= note: perhaps two different versions of crate `git_date` are being used?
error[E0271]: type mismatch resolving `<fn() -> git_date::Time {git_date::time::init::<impl git_date::Time>::now_local_or_utc} as FnOnce<()>>::Output == git_actor::Time`
--> /home/yooakim/.cargo/registry/src/github.com-1ecc6299db9ec823/git-repository-0.21.1/src/repository/identity.rs:46:36
|
46 | time: p.committer.time.unwrap_or_else(git_date::Time::now_local_or_utc),
| ^^^^^^^^^^^^^^ expected struct `git_actor::Time`, found struct `git_date::Time`
|
= note: perhaps two different versions of crate `git_date` are being used?
note: required by a bound in `Option::<T>::unwrap_or_else`
error[E0271]: type mismatch resolving `<fn() -> git_date::Time {git_date::time::init::<impl git_date::Time>::now_local_or_utc} as FnOnce<()>>::Output == git_actor::Time`
--> /home/yooakim/.cargo/registry/src/github.com-1ecc6299db9ec823/git-repository-0.21.1/src/repository/identity.rs:74:33
|
74 | time: p.author.time.unwrap_or_else(git_date::Time::now_local_or_utc),
| ^^^^^^^^^^^^^^ expected struct `git_actor::Time`, found struct `git_date::Time`
|
= note: perhaps two different versions of crate `git_date` are being used?
note: required by a bound in `Option::<T>::unwrap_or_else`
error[E0308]: mismatched types
--> /home/yooakim/.cargo/registry/src/github.com-1ecc6299db9ec823/git-repository-0.21.1/src/repository/identity.rs:147:23
|
147 | time: committer_date,
| ^^^^^^^^^^^^^^ expected struct `git_actor::Time`, found struct `git_date::Time`
|
= note: expected enum `Option<git_actor::Time>`
found enum `Option<git_date::Time>`
= note: perhaps two different versions of crate `git_date` are being used?
error[E0308]: mismatched types
--> /home/yooakim/.cargo/registry/src/github.com-1ecc6299db9ec823/git-repository-0.21.1/src/repository/identity.rs:152:23
|
152 | time: author_date,
| ^^^^^^^^^^^ expected struct `git_actor::Time`, found struct `git_date::Time`
|
= note: expected enum `Option<git_actor::Time>`
found enum `Option<git_date::Time>`
= note: perhaps two different versions of crate `git_date` are being used?
Compiling enumflags2 v0.7.5
Compiling os_info v3.5.0
Compiling zvariant v3.6.0
error[E0308]: mismatched types
--> /home/yooakim/.cargo/registry/src/github.com-1ecc6299db9ec823/git-repository-0.21.1/src/revision/spec/parse/error.rs:94:43
|
94 | ... date: commit.committer().time,
| ^^^^^^^^^^^^^^^^^^^^^^^ expected struct `git_date::Time`, found struct `git_actor::Time`
|
= note: perhaps two different versions of crate `git_date` are being used?
Some errors have detailed explanations: E0271, E0308.
For more information about an error, try `rustc --explain E0271`.
error: could not compile `git-repository` due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `starship v1.10.2`, intermediate artifacts can be found at `/tmp/cargo-installKOuT8C`
I am using Ubuntu 20.04.4 LTS in WSL2 on Windows 11.
Environment
- Ubuntu version: Ubuntu 20.04.4 LTS
- rustup 1.25.1 (bb60b1e89 2022-07-12)
- rustc 1.63.0 (4b91a6ea7 2022-08-08)
- bash version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 16 (6 by maintainers)
Commits related to this issue
- Also install starship as part of CI This should catch issues like these: https://github.com/starship/starship/issues/4310 — committed to Byron/gitoxide by Byron 2 years ago
Ok, so if you use cargo install-update use this:
I noticed the issue described by IP as well, but it disappeared by itself after creating another release. The issue seems to be that somehow it manages to pull in
git-date:0.0.4andgit-date:0.1.0into the same dependency tree.Update: The issue still persists (when not using
--locked), and I could reproduce it as well. Once the latestmasterofstarshipis released that should be fixed for good.Cargo.tomldoesn’t contain any transitive dependencies, which I think was the main culprit here. And the silent upgrades can be desirable in cases they do work (which it does most of the time).