From 2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:50 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- .../src/ty/normalize_erasing_regions.rs | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'compiler/rustc_middle/src/ty/normalize_erasing_regions.rs') diff --git a/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs b/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs index ee13920d5..7c59879a1 100644 --- a/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs +++ b/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs @@ -7,16 +7,14 @@ //! `normalize_generic_arg_after_erasing_regions` query for each type //! or constant found within. (This underlying query is what is cached.) -use crate::mir; use crate::traits::query::NoSolution; use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder}; -use crate::ty::{self, EarlyBinder, SubstsRef, Ty, TyCtxt}; +use crate::ty::{self, EarlyBinder, SubstsRef, Ty, TyCtxt, TypeVisitableExt}; #[derive(Debug, Copy, Clone, HashStable, TyEncodable, TyDecodable)] pub enum NormalizationError<'tcx> { Type(Ty<'tcx>), Const(ty::Const<'tcx>), - ConstantKind(mir::ConstantKind<'tcx>), } impl<'tcx> NormalizationError<'tcx> { @@ -24,7 +22,6 @@ impl<'tcx> NormalizationError<'tcx> { match self { NormalizationError::Type(t) => format!("{}", t), NormalizationError::Const(c) => format!("{}", c), - NormalizationError::ConstantKind(ck) => format!("{}", ck), } } } @@ -38,7 +35,7 @@ impl<'tcx> TyCtxt<'tcx> { #[tracing::instrument(level = "debug", skip(self, param_env))] pub fn normalize_erasing_regions(self, param_env: ty::ParamEnv<'tcx>, value: T) -> T where - T: TypeFoldable<'tcx>, + T: TypeFoldable>, { debug!( "normalize_erasing_regions::<{}>(value={:?}, param_env={:?})", @@ -70,7 +67,7 @@ impl<'tcx> TyCtxt<'tcx> { value: T, ) -> Result> where - T: TypeFoldable<'tcx>, + T: TypeFoldable>, { debug!( "try_normalize_erasing_regions::<{}>(value={:?}, param_env={:?})", @@ -107,7 +104,7 @@ impl<'tcx> TyCtxt<'tcx> { value: ty::Binder<'tcx, T>, ) -> T where - T: TypeFoldable<'tcx>, + T: TypeFoldable>, { let value = self.erase_late_bound_regions(value); self.normalize_erasing_regions(param_env, value) @@ -127,7 +124,7 @@ impl<'tcx> TyCtxt<'tcx> { value: ty::Binder<'tcx, T>, ) -> Result> where - T: TypeFoldable<'tcx>, + T: TypeFoldable>, { let value = self.erase_late_bound_regions(value); self.try_normalize_erasing_regions(param_env, value) @@ -145,7 +142,7 @@ impl<'tcx> TyCtxt<'tcx> { value: T, ) -> T where - T: TypeFoldable<'tcx>, + T: TypeFoldable>, { debug!( "subst_and_normalize_erasing_regions(\ @@ -169,7 +166,7 @@ impl<'tcx> TyCtxt<'tcx> { value: T, ) -> Result> where - T: TypeFoldable<'tcx>, + T: TypeFoldable>, { debug!( "subst_and_normalize_erasing_regions(\ @@ -196,14 +193,14 @@ impl<'tcx> NormalizeAfterErasingRegionsFolder<'tcx> { let arg = self.param_env.and(arg); self.tcx.try_normalize_generic_arg_after_erasing_regions(arg).unwrap_or_else(|_| bug!( - "Failed to normalize {:?}, maybe try to call `try_normalize_erasing_regions` instead", - arg.value - )) + "Failed to normalize {:?}, maybe try to call `try_normalize_erasing_regions` instead", + arg.value + )) } } -impl<'tcx> TypeFolder<'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx> { +impl<'tcx> TypeFolder> for NormalizeAfterErasingRegionsFolder<'tcx> { + fn interner(&self) -> TyCtxt<'tcx> { self.tcx } @@ -238,10 +235,10 @@ impl<'tcx> TryNormalizeAfterErasingRegionsFolder<'tcx> { } } -impl<'tcx> FallibleTypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> { +impl<'tcx> FallibleTypeFolder> for TryNormalizeAfterErasingRegionsFolder<'tcx> { type Error = NormalizationError<'tcx>; - fn tcx(&self) -> TyCtxt<'tcx> { + fn interner(&self) -> TyCtxt<'tcx> { self.tcx } -- cgit v1.2.3