@@ -157,6 +157,10 @@ impl CrateOrigin {
157
157
pub fn is_lib ( & self ) -> bool {
158
158
matches ! ( self , CrateOrigin :: Library { .. } )
159
159
}
160
+
161
+ pub fn is_lang ( & self ) -> bool {
162
+ matches ! ( self , CrateOrigin :: Lang { .. } )
163
+ }
160
164
}
161
165
162
166
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
@@ -174,7 +178,7 @@ impl From<&str> for LangCrateOrigin {
174
178
match s {
175
179
"alloc" => LangCrateOrigin :: Alloc ,
176
180
"core" => LangCrateOrigin :: Core ,
177
- "proc-macro" => LangCrateOrigin :: ProcMacro ,
181
+ "proc-macro" | "proc_macro" => LangCrateOrigin :: ProcMacro ,
178
182
"std" => LangCrateOrigin :: Std ,
179
183
"test" => LangCrateOrigin :: Test ,
180
184
_ => LangCrateOrigin :: Other ,
@@ -522,12 +526,6 @@ impl CrateGraph {
522
526
self . arena . iter ( ) . map ( |( idx, _) | idx)
523
527
}
524
528
525
- // FIXME: used for `handle_hack_cargo_workspace`, should be removed later
526
- #[ doc( hidden) ]
527
- pub fn iter_mut ( & mut self ) -> impl Iterator < Item = ( CrateId , & mut CrateData ) > + ' _ {
528
- self . arena . iter_mut ( )
529
- }
530
-
531
529
/// Returns an iterator over all transitive dependencies of the given crate,
532
530
/// including the crate itself.
533
531
pub fn transitive_deps ( & self , of : CrateId ) -> impl Iterator < Item = CrateId > {
@@ -619,7 +617,12 @@ impl CrateGraph {
619
617
/// This will deduplicate the crates of the graph where possible.
620
618
/// Note that for deduplication to fully work, `self`'s crate dependencies must be sorted by crate id.
621
619
/// If the crate dependencies were sorted, the resulting graph from this `extend` call will also have the crate dependencies sorted.
622
- pub fn extend ( & mut self , mut other : CrateGraph , proc_macros : & mut ProcMacroPaths ) {
620
+ pub fn extend (
621
+ & mut self ,
622
+ mut other : CrateGraph ,
623
+ proc_macros : & mut ProcMacroPaths ,
624
+ on_finished : impl FnOnce ( & FxHashMap < CrateId , CrateId > ) ,
625
+ ) {
623
626
let topo = other. crates_in_topological_order ( ) ;
624
627
let mut id_map: FxHashMap < CrateId , CrateId > = FxHashMap :: default ( ) ;
625
628
for topo in topo {
@@ -670,6 +673,8 @@ impl CrateGraph {
670
673
671
674
* proc_macros =
672
675
mem:: take ( proc_macros) . into_iter ( ) . map ( |( id, macros) | ( id_map[ & id] , macros) ) . collect ( ) ;
676
+
677
+ on_finished ( & id_map) ;
673
678
}
674
679
675
680
fn find_path (
0 commit comments