github / stack-graphs

Rust implementation of stack graphs
https://docs.rs/stack-graphs/*/stack_graphs/
Apache License 2.0
717 stars 122 forks source link

Error when installing #407

Closed juli1 closed 4 months ago

juli1 commented 4 months ago

👋 I am trying to use tree-sitter-stack-graphs and installing the CLI using the steps from the doc does not work. There are many issues at compile time like the one below. Any idea how to make it work?

Rust/Cargo version 1.76.0

Thanks,

cargo install --features cli tree-sitter-stack-graphs

    |
748 |               let languages = languages
    |  _____________________________^
749 | |                 .into_iter()
750 | |                 .zip(configurations.into_iter())
751 | |                 .map(SupplementedLanguage::from)
    | |________________________________________________^ the trait `From<(tree_sitter::Language, &tree_sitter_loader::LanguageConfiguration<'_>)>` is not implemented for `SupplementedLanguage`
    |
    = help: the trait `From<(tree_sitter::Language, &tree_sitter_loader::LanguageConfiguration<'_>)>` is implemented for `SupplementedLanguage`
    = help: for that trait implementation, expected `tree_sitter::Language`, found `tree_sitter::Language`
christianwengert commented 4 months ago

I have the same problem

FFFFplusplus commented 4 months ago

Maybe dependencies has been resolved badly Two versions of the tree-sitter module are in conflict

Workaround

@ lsp-positions/Cargo.toml

tree-sitter = { version=">= 0.19", optional=true }
↓
tree-sitter = { version="~0.20", optional=true }

@ project root

$ cargo build
$ cargo run --features cli -- --version
tree-sitter-stack-graphs 0.7.1

This works fine for me

juli1 commented 4 months ago

I did this and still have errors when invoking cargo build

Among them the following trace.

   --> tree-sitter-stack-graphs/src/lib.rs:678:13
    |
676 |         self.sgl.tsg.execute_into(
    |                      ------------ arguments to this method are incorrect
677 |             &mut self.graph,
678 |             tree,
    |             ^^^^ expected `tree_sitter::Tree`, found `Tree`
hendrikvanantwerpen commented 4 months ago

Thanks for reporting this! The way dependency versions are specified seems to allow for incompatible resolutions like this to happen. I'll see if I can find a solution for this.

hendrikvanantwerpen commented 4 months ago

I've learned some unfortunate things about Cargo dependency resolution, but I managed to get all crates back into an installable state. All crates except for tree-sitter-stack-graphs-javascript have new released that should install just fine.

I also learned that some upstream work is happening in the tree-sitter library that will hopefully help with these problems in the future.

Closing this, but feel free to reopen if things are not installable still.