rust-code-analysis icon indicating copy to clipboard operation
rust-code-analysis copied to clipboard

I can't build rust-code-analysis by tree-sitter version conflicts with tree-sitter-rust

Open pponaldo opened this issue 1 year ago • 1 comments

When I build the code, I can't build it with the following error: There is a version conflict between the dependencies, is there anything you are checking for this?

|
42  |           $name::language()
    |           ^^^^^^^^^^^^^^^^^ expected `tree_sitter::Language`, found a different `tree_sitter::Language`
...
264 |                   fn get_language() -> Language {
    |                                        -------- expected `tree_sitter::Language` because of return type
    |
   ::: /Users/jbpark/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rust-code-analysis-0.0.25/src/langs.rs:8:1
    |
8   | / mk_langs!(
9   | |     // 1) Name for enum
10  | |     // 2) Language description
11  | |     // 3) Display name
...   |
116 | |     )
117 | | );
    | |_- in this macro invocation
    |
    = note: `tree_sitter::Language` and `tree_sitter::Language` have similar names, but are actually distinct types
note: `tree_sitter::Language` is defined in crate `tree_sitter`
   --> /Users/jbpark/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.2/binding_rust/lib.rs:56:1
    |
56  | pub struct Language(*const ffi::TSLanguage);
    | ^^^^^^^^^^^^^^^^^^^
note: `tree_sitter::Language` is defined in crate `tree_sitter`
   --> /Users/jbpark/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.9/binding_rust/lib.rs:43:1
    |
43  | pub struct Language(*const ffi::TSLanguage);
    | ^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tree_sitter` are being used?
    = note: this error originates in the macro `get_language` which comes from the expansion of the macro `mk_langs` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rust-code-analysis` (lib) due to 1 previous error

pponaldo avatar Mar 29 '24 13:03 pponaldo

https://github.com/mozilla/rust-code-analysis/pull/1086 fixes the problem.

jayvdb avatar May 18 '24 00:05 jayvdb

#1086 fixes the problem.

Yep, I just had this failure and rebasing (and then building) update-grammars from @alexle0nte built and all tests passed.

aytey avatar Jul 23 '24 09:07 aytey