mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
Fix ICE in utils::implements_trait
This only happend when debug_assertions were enabled in rustc
This commit is contained in:
parent
d3d2018ead
commit
284c359c61
@ -365,6 +365,9 @@ pub fn implements_trait<'tcx>(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let ty = cx.tcx.erase_regions(ty);
|
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());
|
let ty_params = cx.tcx.mk_substs(ty_params.iter());
|
||||||
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
|
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
|
||||||
}
|
}
|
||||||
|
5
tests/ui/crashes/implements-trait.rs
Normal file
5
tests/ui/crashes/implements-trait.rs
Normal 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());
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user