Skip to content

Commit a949c47

Browse files
committed
Remove ParamEnvAnd::into_parts.
The fields are public, so this doesn't need a method, normal deconstruction and/or field access is good enough.
1 parent c4e3cc0 commit a949c47

File tree

6 files changed

+8
-14
lines changed

6 files changed

+8
-14
lines changed

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ where
277277
// `QueryNormalizeExt::query_normalize` used in the query and `normalize` called below:
278278
// the former fails to normalize the `nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs`
279279
// test. Check after #85499 lands to see if its fixes have erased this difference.
280-
let (param_env, value) = key.into_parts();
280+
let ty::ParamEnvAnd { param_env, value } = key;
281281
let _ = ocx.normalize(&cause, param_env, value.value);
282282

283283
let diag = try_extract_error_from_fulfill_cx(
@@ -324,7 +324,7 @@ where
324324
mbcx.infcx.tcx.infer_ctxt().build_with_canonical(cause.span, &self.canonical_query);
325325
let ocx = ObligationCtxt::new(&infcx);
326326

327-
let (param_env, value) = key.into_parts();
327+
let ty::ParamEnvAnd { param_env, value } = key;
328328
let _ = ocx.deeply_normalize(&cause, param_env, value.value);
329329

330330
let diag = try_extract_error_from_fulfill_cx(

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'tcx> InferCtxt<'tcx> {
4444
where
4545
V: TypeFoldable<TyCtxt<'tcx>>,
4646
{
47-
let (param_env, value) = value.into_parts();
47+
let ty::ParamEnvAnd { param_env, value } = value;
4848
let canonical_param_env = self.tcx.canonical_param_env_cache.get_or_insert(
4949
self.tcx,
5050
param_env,

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,12 +1011,6 @@ pub struct ParamEnvAnd<'tcx, T> {
10111011
pub value: T,
10121012
}
10131013

1014-
impl<'tcx, T> ParamEnvAnd<'tcx, T> {
1015-
pub fn into_parts(self) -> (ParamEnv<'tcx>, T) {
1016-
(self.param_env, self.value)
1017-
}
1018-
}
1019-
10201014
/// The environment in which to do trait solving.
10211015
///
10221016
/// Most of the time you only need to care about the `ParamEnv`

compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(
4444
key: ParamEnvAnd<'tcx, AscribeUserType<'tcx>>,
4545
span: Span,
4646
) -> Result<(), NoSolution> {
47-
let (param_env, AscribeUserType { mir_ty, user_ty }) = key.into_parts();
47+
let ty::ParamEnvAnd { param_env, value: AscribeUserType { mir_ty, user_ty } } = key;
4848
debug!("type_op_ascribe_user_type: mir_ty={:?} user_ty={:?}", mir_ty, user_ty);
4949
match user_ty.kind {
5050
UserTypeKind::Ty(user_ty) => relate_mir_and_user_ty(ocx, param_env, span, mir_ty, user_ty)?,

compiler/rustc_traits/src/implied_outlives_bounds.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_infer::infer::canonical::{self, Canonical};
77
use rustc_infer::traits::query::OutlivesBound;
88
use rustc_infer::traits::query::type_op::ImpliedOutlivesBounds;
99
use rustc_middle::query::Providers;
10-
use rustc_middle::ty::TyCtxt;
10+
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
1111
use rustc_span::DUMMY_SP;
1212
use rustc_trait_selection::infer::InferCtxtBuilderExt;
1313
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>(
2525
NoSolution,
2626
> {
2727
tcx.infer_ctxt().enter_canonical_trait_query(&goal, |ocx, key| {
28-
let (param_env, ImpliedOutlivesBounds { ty }) = key.into_parts();
28+
let ParamEnvAnd { param_env, value: ImpliedOutlivesBounds { ty } } = key;
2929
compute_implied_outlives_bounds_inner(
3030
ocx,
3131
param_env,

compiler/rustc_traits/src/type_op.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn type_op_normalize<'tcx, T>(
4343
where
4444
T: fmt::Debug + TypeFoldable<TyCtxt<'tcx>>,
4545
{
46-
let (param_env, Normalize { value }) = key.into_parts();
46+
let ParamEnvAnd { param_env, value: Normalize { value } } = key;
4747
let Normalized { value, obligations } =
4848
ocx.infcx.at(&ObligationCause::dummy(), param_env).query_normalize(value)?;
4949
ocx.register_obligations(obligations);
@@ -96,6 +96,6 @@ pub fn type_op_prove_predicate_with_cause<'tcx>(
9696
key: ParamEnvAnd<'tcx, ProvePredicate<'tcx>>,
9797
cause: ObligationCause<'tcx>,
9898
) {
99-
let (param_env, ProvePredicate { predicate }) = key.into_parts();
99+
let ParamEnvAnd { param_env, value: ProvePredicate { predicate } } = key;
100100
ocx.register_obligation(Obligation::new(ocx.infcx.tcx, cause, param_env, predicate));
101101
}

0 commit comments

Comments
 (0)