@@ -631,7 +631,12 @@ impl<'a, 'tcx> CrateMetadata {
631
631
ext. kind ( )
632
632
) ;
633
633
let ident = Ident :: with_empty_ctxt ( name) ;
634
- callback ( def:: Export { ident : ident, def : def, span : DUMMY_SP } ) ;
634
+ callback ( def:: Export {
635
+ ident : ident,
636
+ def : def,
637
+ vis : ty:: Visibility :: Public ,
638
+ span : DUMMY_SP ,
639
+ } ) ;
635
640
}
636
641
}
637
642
return
@@ -668,6 +673,7 @@ impl<'a, 'tcx> CrateMetadata {
668
673
callback ( def:: Export {
669
674
def,
670
675
ident : Ident :: from_str ( & self . item_name ( child_index) ) ,
676
+ vis : self . get_visibility ( child_index) ,
671
677
span : self . entry ( child_index) . span . decode ( ( self , sess) ) ,
672
678
} ) ;
673
679
}
@@ -685,23 +691,26 @@ impl<'a, 'tcx> CrateMetadata {
685
691
if let ( Some ( def) , Some ( name) ) =
686
692
( self . get_def ( child_index) , def_key. disambiguated_data . data . get_opt_name ( ) ) {
687
693
let ident = Ident :: from_str ( & name) ;
688
- callback ( def:: Export { def : def, ident : ident, span : span } ) ;
694
+ let vis = self . get_visibility ( child_index) ;
695
+ callback ( def:: Export { def, ident, vis, span } ) ;
689
696
// For non-reexport structs and variants add their constructors to children.
690
697
// Reexport lists automatically contain constructors when necessary.
691
698
match def {
692
699
Def :: Struct ( ..) => {
693
700
if let Some ( ctor_def_id) = self . get_struct_ctor_def_id ( child_index) {
694
701
let ctor_kind = self . get_ctor_kind ( child_index) ;
695
702
let ctor_def = Def :: StructCtor ( ctor_def_id, ctor_kind) ;
696
- callback ( def:: Export { def : ctor_def, ident : ident, span : span } ) ;
703
+ let vis = self . get_visibility ( ctor_def_id. index ) ;
704
+ callback ( def:: Export { def : ctor_def, ident, vis, span } ) ;
697
705
}
698
706
}
699
707
Def :: Variant ( def_id) => {
700
708
// Braced variants, unlike structs, generate unusable names in
701
709
// value namespace, they are reserved for possible future use.
702
710
let ctor_kind = self . get_ctor_kind ( child_index) ;
703
711
let ctor_def = Def :: VariantCtor ( def_id, ctor_kind) ;
704
- callback ( def:: Export { def : ctor_def, ident : ident, span : span } ) ;
712
+ let vis = self . get_visibility ( child_index) ;
713
+ callback ( def:: Export { def : ctor_def, ident, vis, span } ) ;
705
714
}
706
715
_ => { }
707
716
}
0 commit comments