Skip to content

Commit

Permalink
Return early to avoid ICE
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed May 30, 2020
1 parent fcc0e8f commit 9fd8e10
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ pub fn implements_trait<'a, 'tcx>(
trait_id: DefId,
ty_params: &[GenericArg<'tcx>],
) -> bool {
// Do not check on infer_types to avoid panic in evaluate_obligation.
if ty.has_infer_types() {
return false;
}
let ty = cx.tcx.erase_regions(&ty);
let ty_params = cx.tcx.mk_substs(ty_params.iter());
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
}
Expand Down

0 comments on commit 9fd8e10

Please sign in to comment.