@@ -15,8 +15,8 @@ use crate::{
15
15
type_ref:: { TraitRef , TypeBound , TypeRef } ,
16
16
visibility:: RawVisibility ,
17
17
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 ,
20
20
} ;
21
21
22
22
#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -40,9 +40,8 @@ impl FunctionData {
40
40
let cfg_options = & crate_graph[ krate] . cfg_options ;
41
41
let item_tree = loc. id . item_tree ( db) ;
42
42
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 ( )
46
45
} else {
47
46
item_tree[ func. visibility ] . clone ( )
48
47
} ;
@@ -177,8 +176,8 @@ impl TypeAliasData {
177
176
let loc = typ. lookup ( db) ;
178
177
let item_tree = loc. id . item_tree ( db) ;
179
178
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 ( )
182
181
} else {
183
182
item_tree[ typ. visibility ] . clone ( )
184
183
} ;
@@ -232,7 +231,6 @@ impl TraitData {
232
231
module_id,
233
232
tr_loc. id . file_id ( ) ,
234
233
ItemContainerId :: TraitId ( tr) ,
235
- Some ( InheritedVisibilityLoc :: new ( tr_def. visibility , tr_loc. id . tree_id ( ) ) ) ,
236
234
) ;
237
235
collector. collect ( tr_loc. id . tree_id ( ) , & tr_def. items ) ;
238
236
@@ -300,7 +298,6 @@ impl ImplData {
300
298
module_id,
301
299
impl_loc. id . file_id ( ) ,
302
300
ItemContainerId :: ImplId ( id) ,
303
- None ,
304
301
) ;
305
302
collector. collect ( impl_loc. id . tree_id ( ) , & impl_def. items ) ;
306
303
@@ -398,8 +395,8 @@ impl ConstData {
398
395
let loc = konst. lookup ( db) ;
399
396
let item_tree = loc. id . item_tree ( db) ;
400
397
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 ( )
403
400
} else {
404
401
item_tree[ konst. visibility ] . clone ( )
405
402
} ;
@@ -446,8 +443,6 @@ struct AssocItemCollector<'a> {
446
443
447
444
items : Vec < ( Name , AssocItemId ) > ,
448
445
attr_calls : Vec < ( AstId < ast:: Item > , MacroCallId ) > ,
449
-
450
- inherited_visibility : Option < InheritedVisibilityLoc > ,
451
446
}
452
447
453
448
impl < ' a > AssocItemCollector < ' a > {
@@ -456,7 +451,6 @@ impl<'a> AssocItemCollector<'a> {
456
451
module_id : ModuleId ,
457
452
file_id : HirFileId ,
458
453
container : ItemContainerId ,
459
- inherited_visibility : Option < InheritedVisibilityLoc > ,
460
454
) -> Self {
461
455
Self {
462
456
db,
@@ -467,8 +461,6 @@ impl<'a> AssocItemCollector<'a> {
467
461
468
462
items : Vec :: new ( ) ,
469
463
attr_calls : Vec :: new ( ) ,
470
-
471
- inherited_visibility,
472
464
}
473
465
}
474
466
@@ -511,12 +503,9 @@ impl<'a> AssocItemCollector<'a> {
511
503
match item {
512
504
AssocItem :: Function ( id) => {
513
505
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 ) ;
520
509
self . items . push ( ( item. name . clone ( ) , def. into ( ) ) ) ;
521
510
}
522
511
AssocItem :: Const ( id) => {
@@ -525,20 +514,16 @@ impl<'a> AssocItemCollector<'a> {
525
514
Some ( name) => name,
526
515
None => continue ,
527
516
} ;
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 ) ;
534
520
self . items . push ( ( name, def. into ( ) ) ) ;
535
521
}
536
522
AssocItem :: TypeAlias ( id) => {
537
523
let item = & item_tree[ id] ;
538
524
let def = TypeAliasLoc {
539
525
container : self . container ,
540
526
id : ItemTreeId :: new ( tree_id, id) ,
541
- inherited_visibility : self . inherited_visibility ,
542
527
}
543
528
. intern ( self . db ) ;
544
529
self . items . push ( ( item. name . clone ( ) , def. into ( ) ) ) ;
0 commit comments