rust-analyzer version: rust-analyzer version: 0.3.1839-standalone (c06ca6c 2024-02-11)
rustc version: rustc 1.75.0 (82e1608df 2023-12-21)
relevant settings: none.
I use the petgraph crate and have this variable with the import, which was correctly inserted with CTRL+. shortcut in VSCode with the help of rust-analyzer:
use petgraph::{
graph::UnGraph,
prelude::{Graph, Undirected},
};
let mut graph: Graph<ItemId, (), Undirected> = UnGraph::new_undirected();
Now I also have a vector of NodeIndex which exists multiple times in the crate, also in petgraph::graph.
When I manually write this import, it works fine, but the analyzer doesn't show it:
error[E0412]: cannot find type `NodeIndex` in this scope
--> my_crate\src\main.rs:137:42
|
137 | let mut neighbours_by_kind: Box<[Vec<NodeIndex>]> =
| ^^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
1 + use petgraph::adj::NodeIndex;
|
1 + use petgraph::csr::NodeIndex;
|
1 + use petgraph::matrix_graph::NodeIndex;
|
1 + use petgraph::stable_graph::NodeIndex;
|
For more information about this error, try `rustc --explain E0412`.
Also in VSCode, it misses the use petgraph::graph::NodeIndex;:

rust-analyzer version: rust-analyzer version: 0.3.1839-standalone (c06ca6c 2024-02-11)
rustc version: rustc 1.75.0 (82e1608df 2023-12-21)
relevant settings: none.
I use the
petgraphcrate and have this variable with the import, which was correctly inserted with CTRL+. shortcut in VSCode with the help of rust-analyzer:Now I also have a vector of
NodeIndexwhich exists multiple times in the crate, also inpetgraph::graph.When I manually write this import, it works fine, but the analyzer doesn't show it:
Also in VSCode, it misses the

use petgraph::graph::NodeIndex;: