Skip to content

Commit 99b9459

Browse files
committed
Fix ICE in utils::implements_trait
This only happend when debug_assertions were enabled in rustc
1 parent dfac9be commit 99b9459

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/tools/clippy/clippy_lints/src/utils/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ pub fn implements_trait<'tcx>(
365365
return false;
366366
}
367367
let ty = cx.tcx.erase_regions(ty);
368+
if ty.has_escaping_bound_vars() {
369+
return false;
370+
}
368371
let ty_params = cx.tcx.mk_substs(ty_params.iter());
369372
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
370373
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#[allow(clippy::needless_borrowed_reference)]
2+
fn main() {
3+
let mut v = Vec::<String>::new();
4+
let _ = v.iter_mut().filter(|&ref a| a.is_empty());
5+
}

0 commit comments

Comments
 (0)