File tree 3 files changed +56
-1
lines changed
compiler/rustc_privacy/src
3 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -775,7 +775,14 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
775
775
}
776
776
// Corner case: if the variant is reachable, but its
777
777
// enum is not, make the enum reachable as well.
778
- self . update ( item. def_id , variant_level) ;
778
+ self . reach ( item. def_id , variant_level) . ty ( ) ;
779
+ }
780
+ if let Some ( hir_id) = variant. data . ctor_hir_id ( ) {
781
+ let ctor_def_id = self . tcx . hir ( ) . local_def_id ( hir_id) ;
782
+ let ctor_level = self . get ( ctor_def_id) ;
783
+ if ctor_level. is_some ( ) {
784
+ self . reach ( item. def_id , ctor_level) . ty ( ) ;
785
+ }
779
786
}
780
787
}
781
788
}
@@ -803,6 +810,13 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
803
810
}
804
811
}
805
812
}
813
+ if let Some ( hir_id) = struct_def. ctor_hir_id ( ) {
814
+ let ctor_def_id = self . tcx . hir ( ) . local_def_id ( hir_id) ;
815
+ let ctor_level = self . get ( ctor_def_id) ;
816
+ if ctor_level. is_some ( ) {
817
+ self . reach ( item. def_id , ctor_level) . ty ( ) ;
818
+ }
819
+ }
806
820
}
807
821
}
808
822
Original file line number Diff line number Diff line change
1
+ // edition:2021
2
+ //! Missing docs lint warns about undocumented exported items.
3
+ //! Use the lint to additionally verify that items are reachable
4
+ //! but not exported.
5
+ #![ allow( non_camel_case_types) ]
6
+ #![ deny( missing_docs) ]
7
+
8
+ mod hidden {
9
+ pub struct s ;
10
+ pub enum e { x, y, z }
11
+ pub use e:: * ;
12
+ impl s {
13
+ pub fn f ( & self ) { }
14
+ }
15
+ impl e {
16
+ pub fn g ( & self ) { }
17
+ }
18
+ }
19
+ // Hide all type definitions while reexporting their constructors:
20
+ mod e { }
21
+ mod x { }
22
+ mod y { }
23
+ mod z { }
24
+ mod s { }
25
+ pub use hidden:: * ;
Original file line number Diff line number Diff line change
1
+ // Verify that a type is considered reachable when its constructor is
2
+ // reachable. The auxiliary library is constructed so that all types are
3
+ // shadowed and cannot be named directly, while their constructors are
4
+ // reexported. Regression test for issue #96934.
5
+ //
6
+ // aux-build:ctor_aux.rs
7
+ // edition:2021
8
+ // build-pass
9
+
10
+ extern crate ctor_aux;
11
+
12
+ fn main ( ) {
13
+ ctor_aux:: s. f ( ) ;
14
+ ctor_aux:: x. g ( ) ;
15
+ ctor_aux:: y. g ( ) ;
16
+ }
You can’t perform that action at this time.
0 commit comments