Skip to content

Commit 9fd8e10

Browse files
committed
Return early to avoid ICE
1 parent fcc0e8f commit 9fd8e10

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clippy_lints/src/utils/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ pub fn implements_trait<'a, 'tcx>(
323323
trait_id: DefId,
324324
ty_params: &[GenericArg<'tcx>],
325325
) -> bool {
326+
// Do not check on infer_types to avoid panic in evaluate_obligation.
327+
if ty.has_infer_types() {
328+
return false;
329+
}
330+
let ty = cx.tcx.erase_regions(&ty);
326331
let ty_params = cx.tcx.mk_substs(ty_params.iter());
327332
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
328333
}

0 commit comments

Comments
 (0)