Skip to content

Commit 63138a9

Browse files
authored
Merge pull request #19241 from Veykril/push-lqumoruvuyvo
Fix sysroot crate-graph construction not mapping crate-ids for proc-macros
2 parents 505b52d + d813413 commit 63138a9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/project-model/src/workspace.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,7 @@ fn cargo_to_crate_graph(
10941094
) -> (CrateGraph, ProcMacroPaths) {
10951095
let _p = tracing::info_span!("cargo_to_crate_graph").entered();
10961096
let mut res = (CrateGraph::default(), ProcMacroPaths::default());
1097-
let crate_graph = &mut res.0;
1098-
let proc_macros = &mut res.1;
1097+
let (crate_graph, proc_macros) = &mut res;
10991098
let (public_deps, libproc_macro) =
11001099
sysroot_to_crate_graph(crate_graph, sysroot, rustc_cfg.clone(), load);
11011100

@@ -1560,6 +1559,10 @@ fn extend_crate_graph_with_sysroot(
15601559

15611560
// Remove all crates except the ones we are interested in to keep the sysroot graph small.
15621561
let removed_mapping = sysroot_crate_graph.remove_crates_except(&marker_set);
1562+
sysroot_proc_macros = sysroot_proc_macros
1563+
.into_iter()
1564+
.filter_map(|(k, v)| Some((removed_mapping[k.into_raw().into_u32() as usize]?, v)))
1565+
.collect();
15631566
let mapping = crate_graph.extend(sysroot_crate_graph, &mut sysroot_proc_macros);
15641567

15651568
// Map the id through the removal mapping first, then through the crate graph extension mapping.

0 commit comments

Comments
 (0)