@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint;
2
2
use clippy_utils:: trait_ref_of_method;
3
3
use rustc_data_structures:: fx:: FxHashMap ;
4
4
use 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 } ;
6
6
use rustc_lint:: { LateContext , LateLintPass } ;
7
7
use rustc_middle:: hir:: nested_filter;
8
8
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
@@ -74,6 +74,12 @@ impl<'cx, 'tcx> Visitor<'tcx> for TypeWalker<'cx, 'tcx> {
74
74
fn visit_ty ( & mut self , t : & ' tcx Ty < ' tcx > ) {
75
75
if let Some ( ( def_id, _) ) = t. peel_refs ( ) . as_generic_param ( ) {
76
76
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) ;
77
83
} else {
78
84
walk_ty ( self , t) ;
79
85
}
0 commit comments