diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /compiler/rustc_middle/src/ty/instance.rs | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_middle/src/ty/instance.rs')
-rw-r--r-- | compiler/rustc_middle/src/ty/instance.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index 6ac00d16c..f4028a5a9 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -1,7 +1,7 @@ use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; use crate::ty::print::{FmtPrinter, Printer}; -use crate::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitable}; -use crate::ty::{EarlyBinder, InternalSubsts, SubstsRef}; +use crate::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable}; +use crate::ty::{EarlyBinder, InternalSubsts, SubstsRef, TypeVisitableExt}; use rustc_errors::ErrorGuaranteed; use rustc_hir::def::Namespace; use rustc_hir::def_id::{CrateNum, DefId}; @@ -103,7 +103,7 @@ impl<'tcx> Instance<'tcx> { /// lifetimes erased, allowing a `ParamEnv` to be specified for use during normalization. pub fn ty(&self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Ty<'tcx> { let ty = tcx.type_of(self.def.def_id()); - tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty) + tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty.skip_binder()) } /// Finds a crate that contains a monomorphization of this instance that @@ -459,7 +459,7 @@ impl<'tcx> Instance<'tcx> { substs: SubstsRef<'tcx>, ) -> Option<Instance<'tcx>> { debug!("resolve_for_vtable(def_id={:?}, substs={:?})", def_id, substs); - let fn_sig = tcx.fn_sig(def_id); + let fn_sig = tcx.fn_sig(def_id).subst_identity(); let is_vtable_shim = !fn_sig.inputs().skip_binder().is_empty() && fn_sig.input(0).skip_binder().is_param(0) && tcx.generics_of(def_id).has_self; @@ -540,7 +540,7 @@ impl<'tcx> Instance<'tcx> { pub fn resolve_drop_in_place(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { let def_id = tcx.require_lang_item(LangItem::DropInPlace, None); - let substs = tcx.intern_substs(&[ty.into()]); + let substs = tcx.mk_substs(&[ty.into()]); Instance::expect_resolve(tcx, ty::ParamEnv::reveal_all(), def_id, substs) } @@ -584,12 +584,12 @@ impl<'tcx> Instance<'tcx> { /// this function returns `None`, then the MIR body does not require substitution during /// codegen. fn substs_for_mir_body(&self) -> Option<SubstsRef<'tcx>> { - if self.def.has_polymorphic_mir_body() { Some(self.substs) } else { None } + self.def.has_polymorphic_mir_body().then_some(self.substs) } pub fn subst_mir<T>(&self, tcx: TyCtxt<'tcx>, v: &T) -> T where - T: TypeFoldable<'tcx> + Copy, + T: TypeFoldable<TyCtxt<'tcx>> + Copy, { if let Some(substs) = self.substs_for_mir_body() { EarlyBinder(*v).subst(tcx, substs) @@ -606,7 +606,7 @@ impl<'tcx> Instance<'tcx> { v: T, ) -> T where - T: TypeFoldable<'tcx> + Clone, + T: TypeFoldable<TyCtxt<'tcx>> + Clone, { if let Some(substs) = self.substs_for_mir_body() { tcx.subst_and_normalize_erasing_regions(substs, param_env, v) @@ -623,7 +623,7 @@ impl<'tcx> Instance<'tcx> { v: T, ) -> Result<T, NormalizationError<'tcx>> where - T: TypeFoldable<'tcx> + Clone, + T: TypeFoldable<TyCtxt<'tcx>> + Clone, { if let Some(substs) = self.substs_for_mir_body() { tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v) @@ -662,7 +662,7 @@ fn polymorphize<'tcx>( let def_id = instance.def_id(); let upvars_ty = if tcx.is_closure(def_id) { Some(substs.as_closure().tupled_upvars_ty()) - } else if tcx.type_of(def_id).is_generator() { + } else if tcx.type_of(def_id).skip_binder().is_generator() { Some(substs.as_generator().tupled_upvars_ty()) } else { None @@ -674,8 +674,8 @@ fn polymorphize<'tcx>( tcx: TyCtxt<'tcx>, } - impl<'tcx> ty::TypeFolder<'tcx> for PolymorphizationFolder<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx> { + impl<'tcx> ty::TypeFolder<TyCtxt<'tcx>> for PolymorphizationFolder<'tcx> { + fn interner(&self) -> TyCtxt<'tcx> { self.tcx } |