Remove even more redundant builtin candidates

This commit is contained in:
Michael Goulet 2023-06-16 02:10:10 +00:00
parent 2835d9d1d3
commit d97d4ebecc
6 changed files with 96 additions and 138 deletions

View file

@ -781,7 +781,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
);
return;
}
Ok(Some(ImplSource::Closure(_))) => {
// Closure: Fn{Once|Mut}
Ok(Some(ImplSource::Builtin(_)))
if poly_trait_pred.self_ty().skip_binder().is_closure()
&& tcx.fn_trait_kind_from_def_id(trait_id).is_some() =>
{
let ty::Closure(closure_def_id, substs) =
*poly_trait_pred.self_ty().no_bound_vars().unwrap().kind()
else {