@@ -4,7 +4,7 @@ use clippy_utils::ty::{is_normalizable, is_type_diagnostic_item, match_type};
4
4
use if_chain:: if_chain;
5
5
use rustc_hir:: { self as hir, HirId , ItemKind , Node } ;
6
6
use rustc_lint:: { LateContext , LateLintPass } ;
7
- use rustc_middle:: ty:: { Adt , Ty } ;
7
+ use rustc_middle:: ty:: { Adt , Ty , TypeFoldable } ;
8
8
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
9
9
use rustc_span:: sym;
10
10
use rustc_target:: abi:: LayoutOf as _;
@@ -52,6 +52,9 @@ impl LateLintPass<'_> for ZeroSizedMapValues {
52
52
if is_type_diagnostic_item( cx, ty, sym:: hashmap_type) || match_type( cx, ty, & paths:: BTREEMAP ) ;
53
53
if let Adt ( _, substs) = ty. kind( ) ;
54
54
let ty = substs. type_at( 1 ) ;
55
+ // Fixes https://github.com/rust-lang/rust-clippy/issues/7447 because of
56
+ // https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/sty.rs#L968
57
+ if !ty. has_escaping_bound_vars( ) ;
55
58
// Do this to prevent `layout_of` crashing, being unable to fully normalize `ty`.
56
59
if is_normalizable( cx, cx. param_env, ty) ;
57
60
if let Ok ( layout) = cx. layout_of( ty) ;
0 commit comments