18
18
19
19
#![ recursion_limit="256" ]
20
20
21
+ #[ macro_use] extern crate log;
21
22
#[ macro_use] extern crate rustc;
22
23
#[ macro_use] extern crate syntax;
23
24
extern crate rustc_typeck;
@@ -147,6 +148,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
147
148
}
148
149
149
150
fn visit_item ( & mut self , item : & ' tcx hir:: Item ) {
151
+ debug ! ( "Walked item {:?}" , item) ;
150
152
let inherited_item_level = match item. node {
151
153
// Impls inherit level from their types and traits
152
154
hir:: ItemKind :: Impl ( ..) => {
@@ -164,13 +166,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
164
166
hir:: ItemKind :: Trait ( ..) | hir:: ItemKind :: TraitAlias ( ..) |
165
167
hir:: ItemKind :: Existential ( ..) |
166
168
hir:: ItemKind :: Ty ( ..) | hir:: ItemKind :: Union ( ..) | hir:: ItemKind :: Use ( ..) => {
169
+ if let hir:: ItemKind :: Fn ( ref _decl, ref _header, ref _generics, ref _body) = item. node {
170
+ debug ! ( "Walked function" ) ;
171
+ }
167
172
if item. vis . node . is_pub ( ) { self . prev_level } else { None }
168
173
}
169
174
} ;
170
175
171
176
// Update level of the item itself
172
177
let item_level = self . update ( item. id , inherited_item_level) ;
173
178
179
+ debug ! ( "believed to be: {:?}" , item_level) ;
180
+
174
181
// Update levels of nested things
175
182
match item. node {
176
183
hir:: ItemKind :: Enum ( ref def, _) => {
@@ -1737,6 +1744,8 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1737
1744
}
1738
1745
visitor. update ( ast:: CRATE_NODE_ID , Some ( AccessLevel :: Public ) ) ;
1739
1746
1747
+ debug ! ( "access levels after embargo: {:?}" , & visitor. access_levels) ;
1748
+
1740
1749
{
1741
1750
let mut visitor = ObsoleteVisiblePrivateTypesVisitor {
1742
1751
tcx,
@@ -1766,6 +1775,8 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1766
1775
krate. visit_all_item_likes ( & mut DeepVisitor :: new ( & mut visitor) ) ;
1767
1776
}
1768
1777
1778
+ debug ! ( "final access levels: {:?}" , & visitor. access_levels) ;
1779
+
1769
1780
Lrc :: new ( visitor. access_levels )
1770
1781
}
1771
1782
0 commit comments