@@ -159,24 +159,30 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
159
159
hir:: ItemKind :: ForeignMod ( ..) => {
160
160
self . prev_level
161
161
}
162
+ // Impl trait return types mark their parent function.
163
+ // It (and its children) are revisited if the change applies.
164
+ hir:: ItemKind :: Existential ( ref ty_data) => {
165
+ if let Some ( impl_trait_fn) = ty_data. impl_trait_fn {
166
+ if let Some ( node_id) = self . tcx . hir . as_local_node_id ( impl_trait_fn) {
167
+ self . update ( node_id, Some ( AccessLevel :: Reachable ) ) ;
168
+ }
169
+ }
170
+ if item. vis . node . is_pub ( ) { self . prev_level } else { None }
171
+ }
162
172
// Other `pub` items inherit levels from parents
163
173
hir:: ItemKind :: Const ( ..) | hir:: ItemKind :: Enum ( ..) | hir:: ItemKind :: ExternCrate ( ..) |
164
174
hir:: ItemKind :: GlobalAsm ( ..) | hir:: ItemKind :: Fn ( ..) | hir:: ItemKind :: Mod ( ..) |
165
175
hir:: ItemKind :: Static ( ..) | hir:: ItemKind :: Struct ( ..) |
166
176
hir:: ItemKind :: Trait ( ..) | hir:: ItemKind :: TraitAlias ( ..) |
167
- hir:: ItemKind :: Existential ( ..) |
168
177
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
- }
172
178
if item. vis . node . is_pub ( ) { self . prev_level } else { None }
173
179
}
174
180
} ;
175
181
176
182
// Update level of the item itself
177
183
let item_level = self . update ( item. id , inherited_item_level) ;
178
184
179
- debug ! ( "believed to be: {:?}" , item_level) ;
185
+ debug ! ( "Its privacy is believed to be: {:?}" , item_level) ;
180
186
181
187
// Update levels of nested things
182
188
match item. node {
0 commit comments