Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 03983fb

Browse files
committedOct 17, 2024
Auto merge of #131827 - matthiaskrgr:rollup-umncb57, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #128391 (Change orphan hint from "only" to "any uncovered type inside...") - #131583 (Setting up indirect access to external data for loongarch64-linux-{musl,ohos}) - #131595 (rustdoc-JSON: Rename "object safe" to "dyn compatible") - #131748 (cleanup canonical queries) - #131798 (llvm: Tolerate propagated range metadata) - #131815 (compiler: use `is_none_or` where it is clearly better) - #131822 (extract `expr_assign_expected_bool_error`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 06d261d + c735655 commit 03983fb

File tree

86 files changed

+602
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+602
-565
lines changed
 

‎compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ use std::rc::Rc;
33

44
use rustc_errors::Diag;
55
use rustc_hir::def_id::LocalDefId;
6-
use rustc_infer::infer::canonical::Canonical;
6+
use rustc_infer::infer::canonical::CanonicalQueryInput;
77
use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
88
use rustc_infer::infer::{
99
InferCtxt, RegionResolutionError, RegionVariableOrigin, SubregionOrigin, TyCtxtInferExt as _,
1010
};
1111
use rustc_infer::traits::ObligationCause;
12+
use rustc_infer::traits::query::{
13+
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpNormalizeGoal,
14+
CanonicalTypeOpProvePredicateGoal,
15+
};
1216
use rustc_middle::ty::error::TypeError;
1317
use rustc_middle::ty::{
1418
self, RePlaceholder, Region, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex,
@@ -95,9 +99,7 @@ impl<'tcx> ToUniverseInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tc
9599
}
96100
}
97101

98-
impl<'tcx> ToUniverseInfo<'tcx>
99-
for Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::prove_predicate::ProvePredicate<'tcx>>>
100-
{
102+
impl<'tcx> ToUniverseInfo<'tcx> for CanonicalTypeOpProvePredicateGoal<'tcx> {
101103
fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
102104
UniverseInfo(UniverseInfoInner::TypeOp(Rc::new(PredicateQuery {
103105
canonical_query: self,
@@ -107,7 +109,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
107109
}
108110

109111
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx> ToUniverseInfo<'tcx>
110-
for Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>
112+
for CanonicalTypeOpNormalizeGoal<'tcx, T>
111113
{
112114
fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
113115
UniverseInfo(UniverseInfoInner::TypeOp(Rc::new(NormalizeQuery {
@@ -117,9 +119,7 @@ impl<'tcx, T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx> ToUnivers
117119
}
118120
}
119121

120-
impl<'tcx> ToUniverseInfo<'tcx>
121-
for Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::AscribeUserType<'tcx>>>
122-
{
122+
impl<'tcx> ToUniverseInfo<'tcx> for CanonicalTypeOpAscribeUserTypeGoal<'tcx> {
123123
fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
124124
UniverseInfo(UniverseInfoInner::TypeOp(Rc::new(AscribeUserTypeQuery {
125125
canonical_query: self,
@@ -128,7 +128,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
128128
}
129129
}
130130

131-
impl<'tcx, F> ToUniverseInfo<'tcx> for Canonical<'tcx, type_op::custom::CustomTypeOp<F>> {
131+
impl<'tcx, F> ToUniverseInfo<'tcx> for CanonicalQueryInput<'tcx, type_op::custom::CustomTypeOp<F>> {
132132
fn to_universe_info(self, _base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
133133
// We can't rerun custom type ops.
134134
UniverseInfo::other()
@@ -211,16 +211,15 @@ trait TypeOpInfo<'tcx> {
211211
}
212212

213213
struct PredicateQuery<'tcx> {
214-
canonical_query:
215-
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::prove_predicate::ProvePredicate<'tcx>>>,
214+
canonical_query: CanonicalTypeOpProvePredicateGoal<'tcx>,
216215
base_universe: ty::UniverseIndex,
217216
}
218217

219218
impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
220219
fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> Diag<'tcx> {
221220
tcx.dcx().create_err(HigherRankedLifetimeError {
222221
cause: Some(HigherRankedErrorCause::CouldNotProve {
223-
predicate: self.canonical_query.value.value.predicate.to_string(),
222+
predicate: self.canonical_query.canonical.value.value.predicate.to_string(),
224223
}),
225224
span,
226225
})
@@ -253,7 +252,7 @@ impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
253252
}
254253

255254
struct NormalizeQuery<'tcx, T> {
256-
canonical_query: Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>,
255+
canonical_query: CanonicalTypeOpNormalizeGoal<'tcx, T>,
257256
base_universe: ty::UniverseIndex,
258257
}
259258

@@ -264,7 +263,7 @@ where
264263
fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> Diag<'tcx> {
265264
tcx.dcx().create_err(HigherRankedLifetimeError {
266265
cause: Some(HigherRankedErrorCause::CouldNotNormalize {
267-
value: self.canonical_query.value.value.value.to_string(),
266+
value: self.canonical_query.canonical.value.value.value.to_string(),
268267
}),
269268
span,
270269
})
@@ -306,7 +305,7 @@ where
306305
}
307306

308307
struct AscribeUserTypeQuery<'tcx> {
309-
canonical_query: Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::AscribeUserType<'tcx>>>,
308+
canonical_query: CanonicalTypeOpAscribeUserTypeGoal<'tcx>,
310309
base_universe: ty::UniverseIndex,
311310
}
312311

‎compiler/rustc_borrowck/src/type_check/canonical.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
137137
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
138138
locations,
139139
category,
140-
param_env.and(type_op::prove_predicate::ProvePredicate::new(predicate)),
140+
param_env.and(type_op::prove_predicate::ProvePredicate { predicate }),
141141
);
142142
}
143143

@@ -162,7 +162,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
162162
let result: Result<_, ErrorGuaranteed> = self.fully_perform_op(
163163
location.to_locations(),
164164
category,
165-
param_env.and(type_op::normalize::Normalize::new(value)),
165+
param_env.and(type_op::normalize::Normalize { value }),
166166
);
167167
result.unwrap_or(value)
168168
}
@@ -223,7 +223,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
223223
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
224224
Locations::All(span),
225225
ConstraintCategory::Boring,
226-
self.param_env.and(type_op::ascribe_user_type::AscribeUserType::new(mir_ty, user_ty)),
226+
self.param_env.and(type_op::ascribe_user_type::AscribeUserType { mir_ty, user_ty }),
227227
);
228228
}
229229

0 commit comments

Comments
 (0)
Please sign in to comment.