diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-07-31 09:02:15 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-07-31 15:17:20 +1000 |
| commit | a949c47f0d3c0fb0b444c25cb2eb3323fcc845e6 (patch) | |
| tree | ce7313c9fb900711cf9d5f43961b5281eb8bdd5b /compiler | |
| parent | c4e3cc02281d898a6c9424f1bcebfb5ca38ca37f (diff) | |
| download | rust-a949c47f0d3c0fb0b444c25cb2eb3323fcc845e6.tar.gz rust-a949c47f0d3c0fb0b444c25cb2eb3323fcc845e6.zip | |
Remove `ParamEnvAnd::into_parts`.
The fields are public, so this doesn't need a method, normal deconstruction and/or field access is good enough.
Diffstat (limited to 'compiler')
6 files changed, 8 insertions, 14 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs index 0de4bd67f0c..5545f622cde 100644 --- a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs @@ -277,7 +277,7 @@ where // `QueryNormalizeExt::query_normalize` used in the query and `normalize` called below: // the former fails to normalize the `nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs` // test. Check after #85499 lands to see if its fixes have erased this difference. - let (param_env, value) = key.into_parts(); + let ty::ParamEnvAnd { param_env, value } = key; let _ = ocx.normalize(&cause, param_env, value.value); let diag = try_extract_error_from_fulfill_cx( @@ -324,7 +324,7 @@ where mbcx.infcx.tcx.infer_ctxt().build_with_canonical(cause.span, &self.canonical_query); let ocx = ObligationCtxt::new(&infcx); - let (param_env, value) = key.into_parts(); + let ty::ParamEnvAnd { param_env, value } = key; let _ = ocx.deeply_normalize(&cause, param_env, value.value); let diag = try_extract_error_from_fulfill_cx( diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index 060447ba720..db37669d85b 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -44,7 +44,7 @@ impl<'tcx> InferCtxt<'tcx> { where V: TypeFoldable<TyCtxt<'tcx>>, { - let (param_env, value) = value.into_parts(); + let ty::ParamEnvAnd { param_env, value } = value; let canonical_param_env = self.tcx.canonical_param_env_cache.get_or_insert( self.tcx, param_env, diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index abbb3f2f59a..a8992b88acd 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1011,12 +1011,6 @@ pub struct ParamEnvAnd<'tcx, T> { pub value: T, } -impl<'tcx, T> ParamEnvAnd<'tcx, T> { - pub fn into_parts(self) -> (ParamEnv<'tcx>, T) { - (self.param_env, self.value) - } -} - /// The environment in which to do trait solving. /// /// Most of the time you only need to care about the `ParamEnv` diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs index 81b5a131a32..78e7aef78f1 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs @@ -44,7 +44,7 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>( key: ParamEnvAnd<'tcx, AscribeUserType<'tcx>>, span: Span, ) -> Result<(), NoSolution> { - let (param_env, AscribeUserType { mir_ty, user_ty }) = key.into_parts(); + let ty::ParamEnvAnd { param_env, value: AscribeUserType { mir_ty, user_ty } } = key; debug!("type_op_ascribe_user_type: mir_ty={:?} user_ty={:?}", mir_ty, user_ty); match user_ty.kind { UserTypeKind::Ty(user_ty) => relate_mir_and_user_ty(ocx, param_env, span, mir_ty, user_ty)?, diff --git a/compiler/rustc_traits/src/implied_outlives_bounds.rs b/compiler/rustc_traits/src/implied_outlives_bounds.rs index 6fb483e6dac..397c24ff70c 100644 --- a/compiler/rustc_traits/src/implied_outlives_bounds.rs +++ b/compiler/rustc_traits/src/implied_outlives_bounds.rs @@ -7,7 +7,7 @@ use rustc_infer::infer::canonical::{self, Canonical}; use rustc_infer::traits::query::OutlivesBound; use rustc_infer::traits::query::type_op::ImpliedOutlivesBounds; use rustc_middle::query::Providers; -use rustc_middle::ty::TyCtxt; +use rustc_middle::ty::{ParamEnvAnd, TyCtxt}; use rustc_span::DUMMY_SP; use rustc_trait_selection::infer::InferCtxtBuilderExt; use rustc_trait_selection::traits::query::type_op::implied_outlives_bounds::compute_implied_outlives_bounds_inner; @@ -25,7 +25,7 @@ fn implied_outlives_bounds<'tcx>( NoSolution, > { tcx.infer_ctxt().enter_canonical_trait_query(&goal, |ocx, key| { - let (param_env, ImpliedOutlivesBounds { ty }) = key.into_parts(); + let ParamEnvAnd { param_env, value: ImpliedOutlivesBounds { ty } } = key; compute_implied_outlives_bounds_inner( ocx, param_env, diff --git a/compiler/rustc_traits/src/type_op.rs b/compiler/rustc_traits/src/type_op.rs index e58ad639d20..f77e1994cf4 100644 --- a/compiler/rustc_traits/src/type_op.rs +++ b/compiler/rustc_traits/src/type_op.rs @@ -43,7 +43,7 @@ fn type_op_normalize<'tcx, T>( where T: fmt::Debug + TypeFoldable<TyCtxt<'tcx>>, { - let (param_env, Normalize { value }) = key.into_parts(); + let ParamEnvAnd { param_env, value: Normalize { value } } = key; let Normalized { value, obligations } = ocx.infcx.at(&ObligationCause::dummy(), param_env).query_normalize(value)?; ocx.register_obligations(obligations); @@ -96,6 +96,6 @@ pub fn type_op_prove_predicate_with_cause<'tcx>( key: ParamEnvAnd<'tcx, ProvePredicate<'tcx>>, cause: ObligationCause<'tcx>, ) { - let (param_env, ProvePredicate { predicate }) = key.into_parts(); + let ParamEnvAnd { param_env, value: ProvePredicate { predicate } } = key; ocx.register_obligation(Obligation::new(ocx.infcx.tcx, cause, param_env, predicate)); } |
