@@ -267,8 +267,9 @@ pub struct DesignRoot {
267267 // user => set(users)
268268 users_of : RwLock < FnvHashMap < UnitId , FnvHashSet < UnitId > > > ,
269269
270- // missing primary name => set(affected)
271- missing_primary : RwLock < FnvHashMap < ( Symbol , Symbol ) , FnvHashSet < UnitId > > > ,
270+ // missing unit name => set(affected)
271+ #[ allow( clippy:: type_complexity) ]
272+ missing_unit : RwLock < FnvHashMap < ( Symbol , Symbol , Option < Symbol > ) , FnvHashSet < UnitId > > > ,
272273
273274 // Tracks which units have a "use library.all;" clause.
274275 // library name => set(affected)
@@ -287,7 +288,7 @@ impl DesignRoot {
287288 arenas : FinalArena :: default ( ) ,
288289 libraries : FnvHashMap :: default ( ) ,
289290 users_of : RwLock :: new ( FnvHashMap :: default ( ) ) ,
290- missing_primary : RwLock :: new ( FnvHashMap :: default ( ) ) ,
291+ missing_unit : RwLock :: new ( FnvHashMap :: default ( ) ) ,
291292 users_of_library_all : RwLock :: new ( FnvHashMap :: default ( ) ) ,
292293 }
293294 }
@@ -607,16 +608,21 @@ impl DesignRoot {
607608 }
608609 }
609610
610- /// Make use of a missing primary name. The library unit will be sensitive to adding such a primary unit in the future.
611- pub ( super ) fn make_use_of_missing_primary (
611+ /// Make use of a missing unit name. The library unit will be sensitive to adding such a unit in the future.
612+ pub ( super ) fn make_use_of_missing_unit (
612613 & self ,
613614 user : & UnitId ,
614615 library_name : & Symbol ,
615616 primary_name : & Symbol ,
617+ secondary_name : Option < & Symbol > ,
616618 ) {
617- let mut missing_primary = self . missing_primary . write ( ) ;
618- let key = ( library_name. clone ( ) , primary_name. clone ( ) ) ;
619- match missing_primary. entry ( key) {
619+ let mut missing_unit = self . missing_unit . write ( ) ;
620+ let key = (
621+ library_name. clone ( ) ,
622+ primary_name. clone ( ) ,
623+ secondary_name. cloned ( ) ,
624+ ) ;
625+ match missing_unit. entry ( key) {
620626 Entry :: Occupied ( mut entry) => {
621627 entry. get_mut ( ) . insert ( user. clone ( ) ) ;
622628 }
@@ -659,10 +665,12 @@ impl DesignRoot {
659665 }
660666 }
661667 }
662- let missing_primary = self . missing_primary . read ( ) ;
663- for ( ( library_name, primary_name) , unit_ids) in missing_primary . iter ( ) {
668+ let missing_unit = self . missing_unit . read ( ) ;
669+ for ( ( library_name, primary_name, secondary_name ) , unit_ids) in missing_unit . iter ( ) {
664670 let was_added = added. iter ( ) . any ( |added_id| {
665- added_id. library_name ( ) == library_name && added_id. primary_name ( ) == primary_name
671+ added_id. library_name ( ) == library_name
672+ && added_id. primary_name ( ) == primary_name
673+ && added_id. secondary_name ( ) == secondary_name. as_ref ( )
666674 } ) ;
667675
668676 if was_added {
@@ -686,11 +694,11 @@ impl DesignRoot {
686694 self . reset_affected ( get_all_affected ( & users_of, affected) ) ;
687695 drop ( users_of) ;
688696 drop ( users_of_library_all) ;
689- drop ( missing_primary ) ;
697+ drop ( missing_unit ) ;
690698
691699 let mut users_of = self . users_of . write ( ) ;
692700 let mut users_of_library_all = self . users_of_library_all . write ( ) ;
693- let mut missing_primary = self . missing_primary . write ( ) ;
701+ let mut missing_unit = self . missing_unit . write ( ) ;
694702
695703 // Clean-up after removed units
696704 for removed_unit in removed. iter ( ) {
@@ -701,7 +709,7 @@ impl DesignRoot {
701709 library_all_affected. remove ( removed_unit) ;
702710 }
703711
704- missing_primary . retain ( |_, unit_ids| {
712+ missing_unit . retain ( |_, unit_ids| {
705713 unit_ids. remove ( removed_unit) ;
706714 !unit_ids. is_empty ( )
707715 } ) ;
0 commit comments