altsem / gitu

A TUI Git client inspired by Magit
MIT License
1.78k stars 92 forks source link

error compiling version 20.1 #170

Closed mahmoud-eltahawy closed 4 months ago

mahmoud-eltahawy commented 4 months ago
--> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitu-0.20.1/src/syntax_highlight.rs:105:24 105 "html" => Some(tree_sitter_html::language()), ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tree_sitter::Language, found a different tree_sitter::Language
arguments to this enum variant are incorrect
error[E0277]: can't compare tree_sitter::Language with tree_sitter::Language --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitu-0.20.1/src/syntax_highlight.rs:181:24 181 } else if lang == &tree_sitter_html::language() { ^^ no implementation for tree_sitter::Language == tree_sitter::Language
mahmoud-eltahawy commented 4 months ago

this errors results from cargo install gitu command

mahmoud-eltahawy commented 4 months ago

cloning this repo and cargo build --release is fine but cargo install --path . errors

altsem commented 4 months ago

@mahmoud-eltahawy this is due to cargo not resolving to the exact version as listed in the Cargo.lock file without the --locked flag. It's explained at the bottom of this article: https://doc.rust-lang.org/cargo/reference/resolver.html.

I noticed it does mention it's possible to temporarily update dependencies in Cargo.toml before publishing with a = requirement instead. Might be a good thing :thinking:!

tldr: cargo install --locked gitu

mahmoud-eltahawy commented 4 months ago

i was too lazy to learn about what does that --locked flag do now i know 😄😄

andygeorge commented 4 months ago

This unfortunately happens when Cargo upgrades are managed elsewhere, eg when using topgrade.

altsem commented 4 months ago

I pinned all the tree-sitter dependencies in master: d57c57d (these have been the most problematic). Now cargo install --path . works again on master.