summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_hir_typeck/src/place_op.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /compiler/rustc_hir_typeck/src/place_op.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_hir_typeck/src/place_op.rs')
-rw-r--r--compiler/rustc_hir_typeck/src/place_op.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/compiler/rustc_hir_typeck/src/place_op.rs b/compiler/rustc_hir_typeck/src/place_op.rs
index e2b1dc007..fd43b475e 100644
--- a/compiler/rustc_hir_typeck/src/place_op.rs
+++ b/compiler/rustc_hir_typeck/src/place_op.rs
@@ -6,7 +6,7 @@ use rustc_hir as hir;
use rustc_hir_analysis::autoderef::Autoderef;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_infer::infer::InferOk;
-use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCast};
+use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCoercion};
use rustc_middle::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
use rustc_middle::ty::{self, Ty};
use rustc_span::symbol::{sym, Ident};
@@ -90,7 +90,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
);
}
let reported = err.emit();
- Some((self.tcx.ty_error(reported), self.tcx.ty_error(reported)))
+ Some((Ty::new_error(self.tcx, reported), Ty::new_error(self.tcx, reported)))
}
/// To type-check `base_expr[index_expr]`, we progressively autoderef
@@ -107,7 +107,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
index_expr: &hir::Expr<'_>,
) -> Option<(/*index type*/ Ty<'tcx>, /*element type*/ Ty<'tcx>)> {
let adjusted_ty =
- self.structurally_resolved_type(autoderef.span(), autoderef.final_ty(false));
+ self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
debug!(
"try_index_step(expr={:?}, base_expr={:?}, adjusted_ty={:?}, \
index_ty={:?})",
@@ -138,7 +138,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if unsize {
// We only unsize arrays here.
if let ty::Array(element_ty, _) = adjusted_ty.kind() {
- self_ty = self.tcx.mk_slice(*element_ty);
+ self_ty = Ty::new_slice(self.tcx, *element_ty);
} else {
continue;
}
@@ -162,7 +162,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let ty::Ref(region, _, hir::Mutability::Not) = method.sig.inputs()[0].kind() {
adjustments.push(Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(*region, AutoBorrowMutability::Not)),
- target: self.tcx.mk_ref(
+ target: Ty::new_ref(
+ self.tcx,
*region,
ty::TypeAndMut { mutbl: hir::Mutability::Not, ty: adjusted_ty },
),
@@ -172,7 +173,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
if unsize {
adjustments.push(Adjustment {
- kind: Adjust::Pointer(PointerCast::Unsize),
+ kind: Adjust::Pointer(PointerCoercion::Unsize),
target: method.sig.inputs()[0],
});
}
@@ -427,9 +428,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
allow_two_phase_borrow: AllowTwoPhase::No,
};
adjustment.kind = Adjust::Borrow(AutoBorrow::Ref(*region, mutbl));
- adjustment.target = self
- .tcx
- .mk_ref(*region, ty::TypeAndMut { ty: source, mutbl: mutbl.into() });
+ adjustment.target = Ty::new_ref(
+ self.tcx,
+ *region,
+ ty::TypeAndMut { ty: source, mutbl: mutbl.into() },
+ );
}
source = adjustment.target;
}
@@ -438,7 +441,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let [
..,
Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(..)), .. },
- Adjustment { kind: Adjust::Pointer(PointerCast::Unsize), ref mut target },
+ Adjustment { kind: Adjust::Pointer(PointerCoercion::Unsize), ref mut target },
] = adjustments[..]
{
*target = method.sig.inputs()[0];