1
Fork 0

Stop passing the self-type as a separate argument.

This commit is contained in:
Oli Scherer 2022-11-21 12:24:53 +00:00
parent a4da3f8863
commit 7658e0fccf
38 changed files with 113 additions and 164 deletions

View file

@ -632,11 +632,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
output_ty,
&mut nested,
);
let tr = ty::Binder::dummy(self.tcx().at(cause.span).mk_trait_ref(
LangItem::Sized,
output_ty,
[],
));
let tr =
ty::Binder::dummy(self.tcx().at(cause.span).mk_trait_ref(LangItem::Sized, [output_ty]));
nested.push(Obligation::new(
self.infcx.tcx,
cause,
@ -998,7 +995,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// We can only make objects from sized types.
let tr =
ty::Binder::dummy(tcx.at(cause.span).mk_trait_ref(LangItem::Sized, source, []));
ty::Binder::dummy(tcx.at(cause.span).mk_trait_ref(LangItem::Sized, [source]));
nested.push(predicate_to_obligation(tr.without_const().to_predicate(tcx)));
// If the type is `Foo + 'a`, ensure that the type
@ -1104,8 +1101,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.cause.clone(),
obligation.predicate.def_id(),
obligation.recursion_depth + 1,
source_tail,
[target_tail.into()],
[source_tail, target_tail],
));
}
@ -1135,8 +1131,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.cause.clone(),
obligation.predicate.def_id(),
obligation.recursion_depth + 1,
a_last,
[b_last.into()],
[a_last, b_last],
)
}));
}
@ -1252,11 +1247,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
cause.clone(),
obligation.recursion_depth + 1,
self_ty.rebind(ty::TraitPredicate {
trait_ref: self.tcx().at(cause.span).mk_trait_ref(
LangItem::Destruct,
nested_ty,
[],
),
trait_ref: self
.tcx()
.at(cause.span)
.mk_trait_ref(LangItem::Destruct, [nested_ty]),
constness: ty::BoundConstness::ConstIfConst,
polarity: ty::ImplPolarity::Positive,
}),
@ -1277,11 +1271,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// or it's an ADT (and we need to check for a custom impl during selection)
_ => {
let predicate = self_ty.rebind(ty::TraitPredicate {
trait_ref: self.tcx().at(cause.span).mk_trait_ref(
LangItem::Destruct,
nested_ty,
[],
),
trait_ref: self
.tcx()
.at(cause.span)
.mk_trait_ref(LangItem::Destruct, [nested_ty]),
constness: ty::BoundConstness::ConstIfConst,
polarity: ty::ImplPolarity::Positive,
});