@@ -15,8 +15,8 @@ use crate::{
1515 type_ref:: { TraitRef , TypeBound , TypeRef } ,
1616 visibility:: RawVisibility ,
1717 AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
18- InheritedVisibilityLoc , Intern , ItemContainerId , Lookup , Macro2Id , MacroRulesId , ModuleId ,
19- ProcMacroId , StaticId , TraitId , TypeAliasId , TypeAliasLoc ,
18+ Intern , ItemContainerId , Lookup , Macro2Id , MacroRulesId , ModuleId , ProcMacroId , StaticId ,
19+ TraitId , TypeAliasId , TypeAliasLoc ,
2020} ;
2121
2222#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -40,9 +40,8 @@ impl FunctionData {
4040 let cfg_options = & crate_graph[ krate] . cfg_options ;
4141 let item_tree = loc. id . item_tree ( db) ;
4242 let func = & item_tree[ loc. id . value ] ;
43-
44- let visibility = if let Some ( inherited_vis) = loc. inherited_visibility {
45- inherited_vis. tree_id . item_tree ( db) [ inherited_vis. raw_visibility_id ] . clone ( )
43+ let visibility = if let ItemContainerId :: TraitId ( trait_id) = loc. container {
44+ db. trait_data ( trait_id) . visibility . clone ( )
4645 } else {
4746 item_tree[ func. visibility ] . clone ( )
4847 } ;
@@ -177,8 +176,8 @@ impl TypeAliasData {
177176 let loc = typ. lookup ( db) ;
178177 let item_tree = loc. id . item_tree ( db) ;
179178 let typ = & item_tree[ loc. id . value ] ;
180- let visibility = if let Some ( inherited_vis ) = loc. inherited_visibility {
181- inherited_vis . tree_id . item_tree ( db ) [ inherited_vis . raw_visibility_id ] . clone ( )
179+ let visibility = if let ItemContainerId :: TraitId ( trait_id ) = loc. container {
180+ db . trait_data ( trait_id ) . visibility . clone ( )
182181 } else {
183182 item_tree[ typ. visibility ] . clone ( )
184183 } ;
@@ -232,7 +231,6 @@ impl TraitData {
232231 module_id,
233232 tr_loc. id . file_id ( ) ,
234233 ItemContainerId :: TraitId ( tr) ,
235- Some ( InheritedVisibilityLoc :: new ( tr_def. visibility , tr_loc. id . tree_id ( ) ) ) ,
236234 ) ;
237235 collector. collect ( tr_loc. id . tree_id ( ) , & tr_def. items ) ;
238236
@@ -300,7 +298,6 @@ impl ImplData {
300298 module_id,
301299 impl_loc. id . file_id ( ) ,
302300 ItemContainerId :: ImplId ( id) ,
303- None ,
304301 ) ;
305302 collector. collect ( impl_loc. id . tree_id ( ) , & impl_def. items ) ;
306303
@@ -398,8 +395,8 @@ impl ConstData {
398395 let loc = konst. lookup ( db) ;
399396 let item_tree = loc. id . item_tree ( db) ;
400397 let konst = & item_tree[ loc. id . value ] ;
401- let visibility = if let Some ( inherited_vis ) = loc. inherited_visibility {
402- inherited_vis . tree_id . item_tree ( db ) [ inherited_vis . raw_visibility_id ] . clone ( )
398+ let visibility = if let ItemContainerId :: TraitId ( trait_id ) = loc. container {
399+ db . trait_data ( trait_id ) . visibility . clone ( )
403400 } else {
404401 item_tree[ konst. visibility ] . clone ( )
405402 } ;
@@ -446,8 +443,6 @@ struct AssocItemCollector<'a> {
446443
447444 items : Vec < ( Name , AssocItemId ) > ,
448445 attr_calls : Vec < ( AstId < ast:: Item > , MacroCallId ) > ,
449-
450- inherited_visibility : Option < InheritedVisibilityLoc > ,
451446}
452447
453448impl < ' a > AssocItemCollector < ' a > {
@@ -456,7 +451,6 @@ impl<'a> AssocItemCollector<'a> {
456451 module_id : ModuleId ,
457452 file_id : HirFileId ,
458453 container : ItemContainerId ,
459- inherited_visibility : Option < InheritedVisibilityLoc > ,
460454 ) -> Self {
461455 Self {
462456 db,
@@ -467,8 +461,6 @@ impl<'a> AssocItemCollector<'a> {
467461
468462 items : Vec :: new ( ) ,
469463 attr_calls : Vec :: new ( ) ,
470-
471- inherited_visibility,
472464 }
473465 }
474466
@@ -511,12 +503,9 @@ impl<'a> AssocItemCollector<'a> {
511503 match item {
512504 AssocItem :: Function ( id) => {
513505 let item = & item_tree[ id] ;
514- let def = FunctionLoc {
515- container : self . container ,
516- id : ItemTreeId :: new ( tree_id, id) ,
517- inherited_visibility : self . inherited_visibility ,
518- }
519- . intern ( self . db ) ;
506+ let def =
507+ FunctionLoc { container : self . container , id : ItemTreeId :: new ( tree_id, id) }
508+ . intern ( self . db ) ;
520509 self . items . push ( ( item. name . clone ( ) , def. into ( ) ) ) ;
521510 }
522511 AssocItem :: Const ( id) => {
@@ -525,20 +514,16 @@ impl<'a> AssocItemCollector<'a> {
525514 Some ( name) => name,
526515 None => continue ,
527516 } ;
528- let def = ConstLoc {
529- container : self . container ,
530- id : ItemTreeId :: new ( tree_id, id) ,
531- inherited_visibility : self . inherited_visibility ,
532- }
533- . intern ( self . db ) ;
517+ let def =
518+ ConstLoc { container : self . container , id : ItemTreeId :: new ( tree_id, id) }
519+ . intern ( self . db ) ;
534520 self . items . push ( ( name, def. into ( ) ) ) ;
535521 }
536522 AssocItem :: TypeAlias ( id) => {
537523 let item = & item_tree[ id] ;
538524 let def = TypeAliasLoc {
539525 container : self . container ,
540526 id : ItemTreeId :: new ( tree_id, id) ,
541- inherited_visibility : self . inherited_visibility ,
542527 }
543528 . intern ( self . db ) ;
544529 self . items . push ( ( item. name . clone ( ) , def. into ( ) ) ) ;
0 commit comments