@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint;
22use clippy_utils:: trait_ref_of_method;
33use rustc_data_structures:: fx:: FxHashMap ;
44use rustc_hir:: intravisit:: { walk_impl_item, walk_item, walk_param_bound, walk_ty, Visitor } ;
5- use rustc_hir:: { GenericParamKind , Generics , ImplItem , ImplItemKind , Item , ItemKind , Ty , WherePredicate } ;
5+ use rustc_hir:: { GenericParamKind , Generics , ImplItem , ImplItemKind , Item , ItemKind , Ty , TyKind , WherePredicate } ;
66use rustc_lint:: { LateContext , LateLintPass } ;
77use rustc_middle:: hir:: nested_filter;
88use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
@@ -74,6 +74,12 @@ impl<'cx, 'tcx> Visitor<'tcx> for TypeWalker<'cx, 'tcx> {
7474 fn visit_ty ( & mut self , t : & ' tcx Ty < ' tcx > ) {
7575 if let Some ( ( def_id, _) ) = t. peel_refs ( ) . as_generic_param ( ) {
7676 self . map . remove ( & def_id) ;
77+ } else if let TyKind :: OpaqueDef ( id, _, _) = t. kind {
78+ // Explicitly walk OpaqueDef. Normally `walk_ty` would do the job, but it calls
79+ // `visit_nested_item`, which checks that `Self::NestedFilter::INTER` is set. We're
80+ // using `OnlyBodies`, so the check ends up failing and the type isn't fully walked.
81+ let item = self . nested_visit_map ( ) . item ( id) ;
82+ walk_item ( self , item) ;
7783 } else {
7884 walk_ty ( self , t) ;
7985 }
0 commit comments