@@ -159,24 +159,30 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
159159 hir:: ItemKind :: ForeignMod ( ..) => {
160160 self . prev_level
161161 }
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+ }
162172 // Other `pub` items inherit levels from parents
163173 hir:: ItemKind :: Const ( ..) | hir:: ItemKind :: Enum ( ..) | hir:: ItemKind :: ExternCrate ( ..) |
164174 hir:: ItemKind :: GlobalAsm ( ..) | hir:: ItemKind :: Fn ( ..) | hir:: ItemKind :: Mod ( ..) |
165175 hir:: ItemKind :: Static ( ..) | hir:: ItemKind :: Struct ( ..) |
166176 hir:: ItemKind :: Trait ( ..) | hir:: ItemKind :: TraitAlias ( ..) |
167- hir:: ItemKind :: Existential ( ..) |
168177 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- }
172178 if item. vis . node . is_pub ( ) { self . prev_level } else { None }
173179 }
174180 } ;
175181
176182 // Update level of the item itself
177183 let item_level = self . update ( item. id , inherited_item_level) ;
178184
179- debug ! ( "believed to be: {:?}" , item_level) ;
185+ debug ! ( "Its privacy is believed to be: {:?}" , item_level) ;
180186
181187 // Update levels of nested things
182188 match item. node {
0 commit comments