File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/tools/rust-analyzer/crates/base-db/src Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,7 @@ impl CrateGraph {
505
505
mut other : CrateGraph ,
506
506
proc_macros : & mut ProcMacroPaths ,
507
507
) -> FxHashMap < CrateId , CrateId > {
508
+ self . sort_deps ( ) ;
508
509
let topo = other. crates_in_topological_order ( ) ;
509
510
let mut id_map: FxHashMap < CrateId , CrateId > = FxHashMap :: default ( ) ;
510
511
for topo in topo {
@@ -513,7 +514,9 @@ impl CrateGraph {
513
514
crate_data. dependencies . iter_mut ( ) . for_each ( |dep| dep. crate_id = id_map[ & dep. crate_id ] ) ;
514
515
crate_data. dependencies . sort_by_key ( |dep| dep. crate_id ) ;
515
516
516
- let new_id = self . arena . alloc ( crate_data. clone ( ) ) ;
517
+ let find = self . arena . iter ( ) . find ( |( _, v) | * v == crate_data) ;
518
+ let new_id =
519
+ if let Some ( ( k, _) ) = find { k } else { self . arena . alloc ( crate_data. clone ( ) ) } ;
517
520
id_map. insert ( topo, new_id) ;
518
521
}
519
522
You can’t perform that action at this time.
0 commit comments