Remove some useless ty::Binder::dummy calls

This commit is contained in:
Maybe Waffle
2023-04-25 16:45:08 +00:00
parent 91d495fdf4
commit c727edc0b7
5 changed files with 14 additions and 32 deletions

View File

@@ -313,12 +313,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
Self::consider_implied_clause(
ecx,
goal,
ty::Binder::dummy(ty::TraitRef::new(
tcx,
goal.predicate.def_id(),
[self_ty, generator.resume_ty()],
))
.to_predicate(tcx),
ty::TraitRef::new(tcx, goal.predicate.def_id(), [self_ty, generator.resume_ty()])
.to_predicate(tcx),
// Technically, we need to check that the generator types are Sized,
// but that's already proven by the generator being WF.
[],
@@ -363,10 +359,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
data.iter().map(|pred| goal.with(tcx, pred.with_self_ty(tcx, a_ty))),
);
// The type must be Sized to be unsized.
ecx.add_goal(goal.with(
tcx,
ty::Binder::dummy(ty::TraitRef::new(tcx, sized_def_id, [a_ty])),
));
ecx.add_goal(goal.with(tcx, ty::TraitRef::new(tcx, sized_def_id, [a_ty])));
// The type must outlive the lifetime of the `dyn` we're unsizing into.
ecx.add_goal(
goal.with(tcx, ty::Binder::dummy(ty::OutlivesPredicate(a_ty, region))),
@@ -415,11 +408,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
ecx.eq(goal.param_env, unsized_a_ty, b_ty)?;
ecx.add_goal(goal.with(
tcx,
ty::Binder::dummy(ty::TraitRef::new(
tcx,
goal.predicate.def_id(),
[a_tail_ty, b_tail_ty],
)),
ty::TraitRef::new(tcx, goal.predicate.def_id(), [a_tail_ty, b_tail_ty]),
));
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}
@@ -438,11 +427,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
// Similar to ADTs, require that the rest of the fields are equal.
ecx.add_goal(goal.with(
tcx,
ty::Binder::dummy(ty::TraitRef::new(
tcx,
goal.predicate.def_id(),
[*a_last_ty, *b_last_ty],
)),
ty::TraitRef::new(tcx, goal.predicate.def_id(), [*a_last_ty, *b_last_ty]),
));
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}