Replace tcx.mk_trait_ref
with ty::TraitRef::new
This commit is contained in:
parent
2d8c905e15
commit
46b01abbcd
41 changed files with 193 additions and 125 deletions
|
@ -1111,7 +1111,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
});
|
||||
}
|
||||
if let Some(clone_trait) = tcx.lang_items().clone_trait()
|
||||
&& let trait_ref = tcx.mk_trait_ref(clone_trait, [ty])
|
||||
&& let trait_ref = ty::TraitRef::new(tcx, clone_trait, [ty])
|
||||
&& let o = Obligation::new(
|
||||
tcx,
|
||||
ObligationCause::dummy(),
|
||||
|
|
|
@ -538,7 +538,8 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
|||
|
||||
if let PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) = context {
|
||||
let tcx = self.tcx();
|
||||
let trait_ref = tcx.at(self.last_span).mk_trait_ref(LangItem::Copy, [place_ty.ty]);
|
||||
let trait_ref =
|
||||
ty::TraitRef::from_lang_item(tcx.at(self.last_span), LangItem::Copy, [place_ty.ty]);
|
||||
|
||||
// To have a `Copy` operand, the type `T` of the
|
||||
// value must be `Copy`. Note that we prove that `T: Copy`,
|
||||
|
@ -1237,8 +1238,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
|
||||
self.check_rvalue(body, rv, location);
|
||||
if !self.unsized_feature_enabled() {
|
||||
let trait_ref =
|
||||
tcx.at(self.last_span).mk_trait_ref(LangItem::Sized, [place_ty]);
|
||||
let trait_ref = ty::TraitRef::from_lang_item(
|
||||
tcx.at(self.last_span),
|
||||
LangItem::Sized,
|
||||
[place_ty],
|
||||
);
|
||||
self.prove_trait_ref(
|
||||
trait_ref,
|
||||
location.to_locations(),
|
||||
|
@ -1810,7 +1814,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
Operand::Move(place) => {
|
||||
// Make sure that repeated elements implement `Copy`.
|
||||
let ty = place.ty(body, tcx).ty;
|
||||
let trait_ref = tcx.at(span).mk_trait_ref(LangItem::Copy, [ty]);
|
||||
let trait_ref =
|
||||
ty::TraitRef::from_lang_item(tcx.at(span), LangItem::Copy, [ty]);
|
||||
|
||||
self.prove_trait_ref(
|
||||
trait_ref,
|
||||
|
@ -1823,7 +1828,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}
|
||||
|
||||
&Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, ty) => {
|
||||
let trait_ref = tcx.at(span).mk_trait_ref(LangItem::Sized, [ty]);
|
||||
let trait_ref = ty::TraitRef::from_lang_item(tcx.at(span), LangItem::Sized, [ty]);
|
||||
|
||||
self.prove_trait_ref(
|
||||
trait_ref,
|
||||
|
@ -1835,7 +1840,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
Rvalue::ShallowInitBox(operand, ty) => {
|
||||
self.check_operand(operand, location);
|
||||
|
||||
let trait_ref = tcx.at(span).mk_trait_ref(LangItem::Sized, [*ty]);
|
||||
let trait_ref = ty::TraitRef::from_lang_item(tcx.at(span), LangItem::Sized, [*ty]);
|
||||
|
||||
self.prove_trait_ref(
|
||||
trait_ref,
|
||||
|
@ -1932,9 +1937,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
|
||||
CastKind::Pointer(PointerCast::Unsize) => {
|
||||
let &ty = ty;
|
||||
let trait_ref = tcx
|
||||
.at(span)
|
||||
.mk_trait_ref(LangItem::CoerceUnsized, [op.ty(body, tcx), ty]);
|
||||
let trait_ref = ty::TraitRef::from_lang_item(
|
||||
tcx.at(span),
|
||||
LangItem::CoerceUnsized,
|
||||
[op.ty(body, tcx), ty],
|
||||
);
|
||||
|
||||
self.prove_trait_ref(
|
||||
trait_ref,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue