Skip to content

Commit 50ab306

Browse files
Simplify some canonical type alias names
1 parent 23b1cc1 commit 50ab306

File tree

15 files changed

+52
-55
lines changed

15 files changed

+52
-55
lines changed

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

+7-8
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

+2-2
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

+1-3
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

+1-1
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

+3-3
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_data_structures::fx::FxIndexSet;
88
use rustc_hir::def_id::{DefId, LocalDefId};
99
use rustc_infer::infer::at::ToTrace;
1010
use rustc_infer::infer::canonical::{
11-
Canonical, CanonicalVarValues, CanonicalizedQueryResponse, QueryResponse,
11+
Canonical, CanonicalQueryResponse, CanonicalVarValues, QueryResponse,
1212
};
1313
use rustc_infer::infer::{InferCtxt, InferOk};
1414
use rustc_infer::traits::query::Fallible;
@@ -213,7 +213,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
213213
&self,
214214
inference_vars: CanonicalVarValues<'tcx>,
215215
answer: T,
216-
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
216+
) -> Fallible<CanonicalQueryResponse<'tcx, T>>
217217
where
218218
T: Debug + TypeFoldable<'tcx>,
219219
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,

compiler/rustc_trait_selection/src/traits/mod.rs

+1-1
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

+3-3
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

+3-3
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

+3-3
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

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::infer::canonical::{
2-
Canonicalized, CanonicalizedQueryResponse, OriginalQueryValues, QueryRegionConstraints,
2+
Canonical, CanonicalQueryResponse, OriginalQueryValues, QueryRegionConstraints,
33
};
44
use crate::infer::{InferCtxt, InferOk};
55
use crate::traits::query::Fallible;
66
use crate::traits::ObligationCause;
7-
use rustc_infer::infer::canonical::{Canonical, Certainty};
7+
use rustc_infer::infer::canonical::Certainty;
88
use rustc_infer::traits::query::NoSolution;
99
use rustc_infer::traits::PredicateObligations;
1010
use rustc_middle::ty::fold::TypeFoldable;
@@ -73,8 +73,8 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable<'tcx> + 'tcx {
7373
/// not captured in the return value.
7474
fn perform_query(
7575
tcx: TyCtxt<'tcx>,
76-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
77-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>>;
76+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
77+
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>>;
7878

7979
fn fully_perform_into(
8080
query_key: ParamEnvAnd<'tcx, Self>,
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::fold::TypeFoldable;
44
use rustc_middle::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt};
@@ -18,51 +18,51 @@ where
1818

1919
fn perform_query(
2020
tcx: TyCtxt<'tcx>,
21-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
22-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
21+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
22+
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>> {
2323
T::type_op_method(tcx, canonicalized)
2424
}
2525
}
2626

2727
pub trait Normalizable<'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'tcx> + Copy {
2828
fn type_op_method(
2929
tcx: TyCtxt<'tcx>,
30-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
31-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>>;
30+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
31+
) -> Fallible<CanonicalQueryResponse<'tcx, Self>>;
3232
}
3333

3434
impl<'tcx> Normalizable<'tcx> for Ty<'tcx> {
3535
fn type_op_method(
3636
tcx: TyCtxt<'tcx>,
37-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
38-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
37+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
38+
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
3939
tcx.type_op_normalize_ty(canonicalized)
4040
}
4141
}
4242

4343
impl<'tcx> Normalizable<'tcx> for ty::Predicate<'tcx> {
4444
fn type_op_method(
4545
tcx: TyCtxt<'tcx>,
46-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
47-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
46+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
47+
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
4848
tcx.type_op_normalize_predicate(canonicalized)
4949
}
5050
}
5151

5252
impl<'tcx> Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
5353
fn type_op_method(
5454
tcx: TyCtxt<'tcx>,
55-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
56-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
55+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
56+
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
5757
tcx.type_op_normalize_poly_fn_sig(canonicalized)
5858
}
5959
}
6060

6161
impl<'tcx> Normalizable<'tcx> for ty::FnSig<'tcx> {
6262
fn type_op_method(
6363
tcx: TyCtxt<'tcx>,
64-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
65-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
64+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
65+
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
6666
tcx.type_op_normalize_fn_sig(canonicalized)
6767
}
6868
}

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

+3-3
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::dropck_outlives::{trivial_dropck_outlives, DropckOutlivesResult};
33
use crate::traits::query::Fallible;
44
use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
@@ -30,8 +30,8 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
3030

3131
fn perform_query(
3232
tcx: TyCtxt<'tcx>,
33-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
34-
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
33+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
34+
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>> {
3535
// Subtle: note that we are not invoking
3636
// `infcx.at(...).dropck_outlives(...)` here, but rather the
3737
// underlying `dropck_outlives` query. This same underlying

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

+3-3
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::{self, ParamEnvAnd, TyCtxt};
44

@@ -32,8 +32,8 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
3232

3333
fn perform_query(
3434
tcx: TyCtxt<'tcx>,
35-
mut canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
36-
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
35+
mut canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
36+
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
3737
match canonicalized.value.value.predicate.kind().skip_binder() {
3838
ty::PredicateKind::Clause(ty::Clause::Trait(pred)) => {
3939
canonicalized.value.param_env.remap_constness_with(pred.constness);

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

+3-3
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

@@ -13,8 +13,8 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
1313

1414
fn perform_query(
1515
tcx: TyCtxt<'tcx>,
16-
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
17-
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
16+
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
17+
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
1818
tcx.type_op_subtype(canonicalized)
1919
}
2020
}

0 commit comments

Comments
 (0)