Fix ICE in utils::implements_trait

This only happend when debug_assertions were enabled in rustc
This commit is contained in:
flip1995 2020-11-23 13:52:27 +01:00
parent d3d2018ead
commit 284c359c61
2 changed files with 8 additions and 0 deletions

View file

@ -365,6 +365,9 @@ pub fn implements_trait<'tcx>(
return false;
}
let ty = cx.tcx.erase_regions(ty);
if ty.has_escaping_bound_vars() {
return false;
}
let ty_params = cx.tcx.mk_substs(ty_params.iter());
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
}

View file

@ -0,0 +1,5 @@
#[allow(clippy::needless_borrowed_reference)]
fn main() {
let mut v = Vec::<String>::new();
let _ = v.iter_mut().filter(|&ref a| a.is_empty());
}