Skip to content

Commit f8319bb

Browse files
authored
Rollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnr
Simplify some canonical type alias names * delete the `Canonicalized<'tcx>` type alias in favor for `Canonical<'tcx>` * `CanonicalizedQueryResponse` -> `CanonicalQueryResponse` I don't particularly care about the latter, but it should be consistent. We could alternatively delete the first alias and rename the struct to `Canonicalized`, and then keep the name of `CanonicalizedQueryResponse` untouched.
2 parents 37c1d6d + 50ab306 commit f8319bb

File tree

15 files changed

+52
-55
lines changed

15 files changed

+52
-55
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
//! [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html
77
88
use crate::infer::canonical::{
9-
Canonical, CanonicalTyVarKind, CanonicalVarInfo, CanonicalVarKind, Canonicalized,
10-
OriginalQueryValues,
9+
Canonical, CanonicalTyVarKind, CanonicalVarInfo, CanonicalVarKind, OriginalQueryValues,
1110
};
1211
use crate::infer::InferCtxt;
1312
use rustc_middle::ty::flags::FlagComputation;
@@ -40,7 +39,7 @@ impl<'tcx> InferCtxt<'tcx> {
4039
&self,
4140
value: V,
4241
query_state: &mut OriginalQueryValues<'tcx>,
43-
) -> Canonicalized<'tcx, V>
42+
) -> Canonical<'tcx, V>
4443
where
4544
V: TypeFoldable<'tcx>,
4645
{
@@ -59,7 +58,7 @@ impl<'tcx> InferCtxt<'tcx> {
5958
&self,
6059
value: V,
6160
query_state: &mut OriginalQueryValues<'tcx>,
62-
) -> Canonicalized<'tcx, V>
61+
) -> Canonical<'tcx, V>
6362
where
6463
V: TypeFoldable<'tcx>,
6564
{
@@ -99,7 +98,7 @@ impl<'tcx> InferCtxt<'tcx> {
9998
/// out the [chapter in the rustc dev guide][c].
10099
///
101100
/// [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html#canonicalizing-the-query-result
102-
pub fn canonicalize_response<V>(&self, value: V) -> Canonicalized<'tcx, V>
101+
pub fn canonicalize_response<V>(&self, value: V) -> Canonical<'tcx, V>
103102
where
104103
V: TypeFoldable<'tcx>,
105104
{
@@ -113,7 +112,7 @@ impl<'tcx> InferCtxt<'tcx> {
113112
)
114113
}
115114

116-
pub fn canonicalize_user_type_annotation<V>(&self, value: V) -> Canonicalized<'tcx, V>
115+
pub fn canonicalize_user_type_annotation<V>(&self, value: V) -> Canonical<'tcx, V>
117116
where
118117
V: TypeFoldable<'tcx>,
119118
{
@@ -135,7 +134,7 @@ impl<'tcx> InferCtxt<'tcx> {
135134
&self,
136135
value: V,
137136
query_state: &mut OriginalQueryValues<'tcx>,
138-
) -> Canonicalized<'tcx, V>
137+
) -> Canonical<'tcx, V>
139138
where
140139
V: TypeFoldable<'tcx>,
141140
{
@@ -524,7 +523,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
524523
tcx: TyCtxt<'tcx>,
525524
canonicalize_region_mode: &dyn CanonicalizeMode,
526525
query_state: &mut OriginalQueryValues<'tcx>,
527-
) -> Canonicalized<'tcx, V>
526+
) -> Canonical<'tcx, V>
528527
where
529528
V: TypeFoldable<'tcx>,
530529
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
use crate::infer::canonical::substitute::{substitute_value, CanonicalExt};
1111
use crate::infer::canonical::{
12-
Canonical, CanonicalVarValues, CanonicalizedQueryResponse, Certainty, OriginalQueryValues,
12+
Canonical, CanonicalQueryResponse, CanonicalVarValues, Certainty, OriginalQueryValues,
1313
QueryOutlivesConstraint, QueryRegionConstraints, QueryResponse,
1414
};
1515
use crate::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
@@ -57,7 +57,7 @@ impl<'tcx> InferCtxt<'tcx> {
5757
inference_vars: CanonicalVarValues<'tcx>,
5858
answer: T,
5959
fulfill_cx: &mut dyn TraitEngine<'tcx>,
60-
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
60+
) -> Fallible<CanonicalQueryResponse<'tcx, T>>
6161
where
6262
T: Debug + TypeFoldable<'tcx>,
6363
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,

compiler/rustc_middle/src/infer/canonical.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ impl QueryRegionConstraints<'_> {
213213
}
214214
}
215215

216-
pub type Canonicalized<'tcx, V> = Canonical<'tcx, V>;
217-
218-
pub type CanonicalizedQueryResponse<'tcx, T> = &'tcx Canonical<'tcx, QueryResponse<'tcx, T>>;
216+
pub type CanonicalQueryResponse<'tcx, T> = &'tcx Canonical<'tcx, QueryResponse<'tcx, T>>;
219217

220218
/// Indicates whether or not we were able to prove the query to be
221219
/// true.

compiler/rustc_middle/src/ty/typeck_results.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ pub struct CanonicalUserTypeAnnotation<'tcx> {
626626
pub inferred_ty: Ty<'tcx>,
627627
}
628628

629-
/// Canonicalized user type annotation.
629+
/// Canonical user type annotation.
630630
pub type CanonicalUserType<'tcx> = Canonical<'tcx, UserType<'tcx>>;
631631

632632
impl<'tcx> CanonicalUserType<'tcx> {

compiler/rustc_trait_selection/src/infer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::traits::{self, ObligationCtxt};
44
use rustc_hir::def_id::DefId;
55
use rustc_hir::lang_items::LangItem;
66
use rustc_middle::arena::ArenaAllocatable;
7-
use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse};
7+
use rustc_middle::infer::canonical::{Canonical, CanonicalQueryResponse, QueryResponse};
88
use rustc_middle::traits::query::Fallible;
99
use rustc_middle::ty::{self, Ty, TypeFoldable, TypeVisitable};
1010
use rustc_middle::ty::{GenericArg, ToPredicate};
@@ -102,7 +102,7 @@ pub trait InferCtxtBuilderExt<'tcx> {
102102
&mut self,
103103
canonical_key: &Canonical<'tcx, K>,
104104
operation: impl FnOnce(&ObligationCtxt<'_, 'tcx>, K) -> Fallible<R>,
105-
) -> Fallible<CanonicalizedQueryResponse<'tcx, R>>
105+
) -> Fallible<CanonicalQueryResponse<'tcx, R>>
106106
where
107107
K: TypeFoldable<'tcx>,
108108
R: Debug + TypeFoldable<'tcx>,
@@ -130,7 +130,7 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
130130
&mut self,
131131
canonical_key: &Canonical<'tcx, K>,
132132
operation: impl FnOnce(&ObligationCtxt<'_, 'tcx>, K) -> Fallible<R>,
133-
) -> Fallible<CanonicalizedQueryResponse<'tcx, R>>
133+
) -> Fallible<CanonicalQueryResponse<'tcx, R>>
134134
where
135135
K: TypeFoldable<'tcx>,
136136
R: Debug + TypeFoldable<'tcx>,

compiler/rustc_trait_selection/src/traits/engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_data_structures::fx::FxIndexSet;
99
use rustc_hir::def_id::{DefId, LocalDefId};
1010
use rustc_infer::infer::at::ToTrace;
1111
use rustc_infer::infer::canonical::{
12-
Canonical, CanonicalVarValues, CanonicalizedQueryResponse, QueryResponse,
12+
Canonical, CanonicalQueryResponse, CanonicalVarValues, QueryResponse,
1313
};
1414
use rustc_infer::infer::{InferCtxt, InferOk};
1515
use rustc_infer::traits::query::Fallible;
@@ -215,7 +215,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
215215
&self,
216216
inference_vars: CanonicalVarValues<'tcx>,
217217
answer: T,
218-
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
218+
) -> Fallible<CanonicalQueryResponse<'tcx, T>>
219219
where
220220
T: Debug + TypeFoldable<'tcx>,
221221
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub enum TraitQueryMode {
102102
/// spans etc. passed in and hence can do reasonable
103103
/// error reporting on their own.
104104
Standard,
105-
/// Canonicalized queries get dummy spans and hence
105+
/// Canonical queries get dummy spans and hence
106106
/// must generally propagate errors to
107107
/// pre-canonicalization callsites.
108108
Canonical,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
1+
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
22
use crate::traits::query::Fallible;
33
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
44

@@ -16,8 +16,8 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
1616

1717
fn perform_query(
1818
tcx: TyCtxt<'tcx>,
19-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
20-
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
19+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
20+
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
2121
tcx.type_op_ascribe_user_type(canonicalized)
2222
}
2323
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
1+
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
22
use crate::traits::query::Fallible;
33
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
44

@@ -16,8 +16,8 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
1616

1717
fn perform_query(
1818
tcx: TyCtxt<'tcx>,
19-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
20-
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
19+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
20+
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
2121
tcx.type_op_eq(canonicalized)
2222
}
2323
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
1+
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
22
use crate::traits::query::Fallible;
33
use rustc_infer::traits::query::OutlivesBound;
44
use rustc_middle::ty::{self, ParamEnvAnd, Ty, TyCtxt};
@@ -27,8 +27,8 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
2727

2828
fn perform_query(
2929
tcx: TyCtxt<'tcx>,
30-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
31-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
30+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
31+
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>> {
3232
// FIXME this `unchecked_map` is only necessary because the
3333
// query is defined as taking a `ParamEnvAnd<Ty>`; it should
3434
// take an `ImpliedOutlivesBounds` instead

0 commit comments

Comments
 (0)