Skip to content

Commit 236443c

Browse files
authored
Unrolled build for rust-lang#116912
Rollup merge of rust-lang#116912 - compiler-errors:rustc_type_ir-bikeshedding, r=jackh726 Some renaming nits for `rustc_type_ir` tl;dr: * `ListTy` -> `Tys` * `PlaceholderType` -> `PlaceholderTy` * `RegionVid` -> `InferRegion` * `ListBinderExistentialPredicate` -> `BoundExistentialPredicates` * `GenericArgsRef` -> `GenericArgs` r? jackh726
2 parents 020d008 + 189e6a8 commit 236443c

File tree

4 files changed

+61
-57
lines changed

4 files changed

+61
-57
lines changed

compiler/rustc_middle/src/ty/context.rs

+12-15
Original file line numberDiff line numberDiff line change
@@ -80,43 +80,40 @@ use std::ops::{Bound, Deref};
8080

8181
#[allow(rustc::usage_of_ty_tykind)]
8282
impl<'tcx> Interner for TyCtxt<'tcx> {
83+
type DefId = DefId;
8384
type AdtDef = ty::AdtDef<'tcx>;
84-
type GenericArgsRef = ty::GenericArgsRef<'tcx>;
85+
type GenericArgs = ty::GenericArgsRef<'tcx>;
8586
type GenericArg = ty::GenericArg<'tcx>;
86-
type DefId = DefId;
8787
type Binder<T> = Binder<'tcx, T>;
88-
type Ty = Ty<'tcx>;
89-
type Const = ty::Const<'tcx>;
90-
type Region = Region<'tcx>;
9188
type Predicate = Predicate<'tcx>;
89+
type PredicateKind = ty::PredicateKind<'tcx>;
9290
type TypeAndMut = TypeAndMut<'tcx>;
9391
type Mutability = hir::Mutability;
9492
type Movability = hir::Movability;
95-
type PolyFnSig = PolyFnSig<'tcx>;
96-
type ListBinderExistentialPredicate = &'tcx List<PolyExistentialPredicate<'tcx>>;
97-
type BinderListTy = Binder<'tcx, &'tcx List<Ty<'tcx>>>;
98-
type ListTy = &'tcx List<Ty<'tcx>>;
93+
type Ty = Ty<'tcx>;
94+
type Tys = &'tcx List<Ty<'tcx>>;
9995
type AliasTy = ty::AliasTy<'tcx>;
10096
type ParamTy = ParamTy;
10197
type BoundTy = ty::BoundTy;
102-
type PlaceholderType = ty::PlaceholderType;
98+
type PlaceholderTy = ty::PlaceholderType;
10399
type InferTy = InferTy;
104100
type ErrorGuaranteed = ErrorGuaranteed;
105-
type PredicateKind = ty::PredicateKind<'tcx>;
101+
type BoundExistentialPredicates = &'tcx List<PolyExistentialPredicate<'tcx>>;
102+
type PolyFnSig = PolyFnSig<'tcx>;
106103
type AllocId = crate::mir::interpret::AllocId;
107-
104+
type Const = ty::Const<'tcx>;
108105
type InferConst = ty::InferConst<'tcx>;
109106
type AliasConst = ty::UnevaluatedConst<'tcx>;
107+
type PlaceholderConst = ty::PlaceholderConst<'tcx>;
110108
type ParamConst = ty::ParamConst;
111109
type BoundConst = ty::BoundVar;
112-
type PlaceholderConst = ty::PlaceholderConst<'tcx>;
113110
type ValueConst = ty::ValTree<'tcx>;
114111
type ExprConst = ty::Expr<'tcx>;
115-
112+
type Region = Region<'tcx>;
116113
type EarlyBoundRegion = ty::EarlyBoundRegion;
117114
type BoundRegion = ty::BoundRegion;
118115
type FreeRegion = ty::FreeRegion;
119-
type RegionVid = ty::RegionVid;
116+
type InferRegion = ty::RegionVid;
120117
type PlaceholderRegion = ty::PlaceholderRegion;
121118

122119
fn ty_and_mut_to_parts(

compiler/rustc_type_ir/src/lib.rs

+22-12
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,43 @@ pub use ty_info::*;
4242
pub trait HashStableContext {}
4343

4444
pub trait Interner: Sized {
45+
type DefId: Clone + Debug + Hash + Ord;
4546
type AdtDef: Clone + Debug + Hash + Ord;
46-
type GenericArgsRef: Clone
47+
48+
type GenericArgs: Clone
4749
+ DebugWithInfcx<Self>
4850
+ Hash
4951
+ Ord
5052
+ IntoIterator<Item = Self::GenericArg>;
5153
type GenericArg: Clone + DebugWithInfcx<Self> + Hash + Ord;
52-
type DefId: Clone + Debug + Hash + Ord;
54+
5355
type Binder<T>;
54-
type Ty: Clone + DebugWithInfcx<Self> + Hash + Ord;
55-
type Const: Clone + DebugWithInfcx<Self> + Hash + Ord;
56-
type Region: Clone + DebugWithInfcx<Self> + Hash + Ord;
56+
57+
// Predicates
5758
type Predicate;
59+
type PredicateKind: Clone + Debug + Hash + PartialEq + Eq;
60+
5861
type TypeAndMut: Clone + Debug + Hash + Ord;
5962
type Mutability: Clone + Debug + Hash + Ord;
6063
type Movability: Clone + Debug + Hash + Ord;
61-
type PolyFnSig: Clone + DebugWithInfcx<Self> + Hash + Ord;
62-
type ListBinderExistentialPredicate: Clone + DebugWithInfcx<Self> + Hash + Ord;
63-
type BinderListTy: Clone + DebugWithInfcx<Self> + Hash + Ord;
64-
type ListTy: Clone + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>;
64+
65+
// Kinds of tys
66+
type Ty: Clone + DebugWithInfcx<Self> + Hash + Ord;
67+
type Tys: Clone + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>;
6568
type AliasTy: Clone + DebugWithInfcx<Self> + Hash + Ord;
6669
type ParamTy: Clone + Debug + Hash + Ord;
6770
type BoundTy: Clone + Debug + Hash + Ord;
68-
type PlaceholderType: Clone + Debug + Hash + Ord;
71+
type PlaceholderTy: Clone + Debug + Hash + Ord;
6972
type InferTy: Clone + DebugWithInfcx<Self> + Hash + Ord;
73+
74+
// Things stored inside of tys
7075
type ErrorGuaranteed: Clone + Debug + Hash + Ord;
71-
type PredicateKind: Clone + Debug + Hash + PartialEq + Eq;
76+
type BoundExistentialPredicates: Clone + DebugWithInfcx<Self> + Hash + Ord;
77+
type PolyFnSig: Clone + DebugWithInfcx<Self> + Hash + Ord;
7278
type AllocId: Clone + Debug + Hash + Ord;
7379

80+
// Kinds of consts
81+
type Const: Clone + DebugWithInfcx<Self> + Hash + Ord;
7482
type InferConst: Clone + DebugWithInfcx<Self> + Hash + Ord;
7583
type AliasConst: Clone + DebugWithInfcx<Self> + Hash + Ord;
7684
type PlaceholderConst: Clone + Debug + Hash + Ord;
@@ -79,10 +87,12 @@ pub trait Interner: Sized {
7987
type ValueConst: Clone + Debug + Hash + Ord;
8088
type ExprConst: Clone + DebugWithInfcx<Self> + Hash + Ord;
8189

90+
// Kinds of regions
91+
type Region: Clone + DebugWithInfcx<Self> + Hash + Ord;
8292
type EarlyBoundRegion: Clone + Debug + Hash + Ord;
8393
type BoundRegion: Clone + Debug + Hash + Ord;
8494
type FreeRegion: Clone + Debug + Hash + Ord;
85-
type RegionVid: Clone + DebugWithInfcx<Self> + Hash + Ord;
95+
type InferRegion: Clone + DebugWithInfcx<Self> + Hash + Ord;
8696
type PlaceholderRegion: Clone + Debug + Hash + Ord;
8797

8898
fn ty_and_mut_to_parts(ty_and_mut: Self::TypeAndMut) -> (Self::Ty, Self::Mutability);

compiler/rustc_type_ir/src/structural_impls.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<I: Interner, T: TypeVisitable<I>, Ix: Idx> TypeVisitable<I> for IndexVec<Ix
208208

209209
pub trait InferCtxtLike<I: Interner> {
210210
fn universe_of_ty(&self, ty: I::InferTy) -> Option<UniverseIndex>;
211-
fn universe_of_lt(&self, lt: I::RegionVid) -> Option<UniverseIndex>;
211+
fn universe_of_lt(&self, lt: I::InferRegion) -> Option<UniverseIndex>;
212212
fn universe_of_ct(&self, ct: I::InferConst) -> Option<UniverseIndex>;
213213
}
214214

@@ -219,7 +219,7 @@ impl<I: Interner> InferCtxtLike<I> for core::convert::Infallible {
219219
fn universe_of_ct(&self, _ct: <I as Interner>::InferConst) -> Option<UniverseIndex> {
220220
match *self {}
221221
}
222-
fn universe_of_lt(&self, _lt: <I as Interner>::RegionVid) -> Option<UniverseIndex> {
222+
fn universe_of_lt(&self, _lt: <I as Interner>::InferRegion) -> Option<UniverseIndex> {
223223
match *self {}
224224
}
225225
}

compiler/rustc_type_ir/src/sty.rs

+25-28
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub enum TyKind<I: Interner> {
7979
///
8080
/// Note that generic parameters in fields only get lazily substituted
8181
/// by using something like `adt_def.all_fields().map(|field| field.ty(tcx, args))`.
82-
Adt(I::AdtDef, I::GenericArgsRef),
82+
Adt(I::AdtDef, I::GenericArgs),
8383

8484
/// An unsized FFI type that is opaque to Rust. Written as `extern type T`.
8585
Foreign(I::DefId),
@@ -111,7 +111,7 @@ pub enum TyKind<I: Interner> {
111111
/// fn foo() -> i32 { 1 }
112112
/// let bar = foo; // bar: fn() -> i32 {foo}
113113
/// ```
114-
FnDef(I::DefId, I::GenericArgsRef),
114+
FnDef(I::DefId, I::GenericArgs),
115115

116116
/// A pointer to a function. Written as `fn() -> i32`.
117117
///
@@ -127,21 +127,21 @@ pub enum TyKind<I: Interner> {
127127
FnPtr(I::PolyFnSig),
128128

129129
/// A trait object. Written as `dyn for<'b> Trait<'b, Assoc = u32> + Send + 'a`.
130-
Dynamic(I::ListBinderExistentialPredicate, I::Region, DynKind),
130+
Dynamic(I::BoundExistentialPredicates, I::Region, DynKind),
131131

132132
/// The anonymous type of a closure. Used to represent the type of `|a| a`.
133133
///
134134
/// Closure args contain both the - potentially substituted - generic parameters
135135
/// of its parent and some synthetic parameters. See the documentation for
136136
/// `ClosureArgs` for more details.
137-
Closure(I::DefId, I::GenericArgsRef),
137+
Closure(I::DefId, I::GenericArgs),
138138

139139
/// The anonymous type of a generator. Used to represent the type of
140140
/// `|a| yield a`.
141141
///
142142
/// For more info about generator args, visit the documentation for
143143
/// `GeneratorArgs`.
144-
Generator(I::DefId, I::GenericArgsRef, I::Movability),
144+
Generator(I::DefId, I::GenericArgs, I::Movability),
145145

146146
/// A type representing the types stored inside a generator.
147147
/// This should only appear as part of the `GeneratorArgs`.
@@ -167,13 +167,13 @@ pub enum TyKind<I: Interner> {
167167
/// }
168168
/// # ;
169169
/// ```
170-
GeneratorWitness(I::DefId, I::GenericArgsRef),
170+
GeneratorWitness(I::DefId, I::GenericArgs),
171171

172172
/// The never type `!`.
173173
Never,
174174

175175
/// A tuple type. For example, `(i32, bool)`.
176-
Tuple(I::ListTy),
176+
Tuple(I::Tys),
177177

178178
/// A projection, opaque type, weak type alias, or inherent associated type.
179179
/// All of these types are represented as pairs of def-id and args, and can
@@ -209,7 +209,7 @@ pub enum TyKind<I: Interner> {
209209
/// to the bound variable's index from the binder from which it was instantiated),
210210
/// and `U` is the universe index in which it is instantiated, or totally omitted
211211
/// if the universe index is zero.
212-
Placeholder(I::PlaceholderType),
212+
Placeholder(I::PlaceholderTy),
213213

214214
/// A type variable used during type checking.
215215
///
@@ -567,7 +567,7 @@ impl<I: Interner, E: TyEncoder> Encodable<E> for TyKind<I>
567567
where
568568
I::ErrorGuaranteed: Encodable<E>,
569569
I::AdtDef: Encodable<E>,
570-
I::GenericArgsRef: Encodable<E>,
570+
I::GenericArgs: Encodable<E>,
571571
I::DefId: Encodable<E>,
572572
I::Ty: Encodable<E>,
573573
I::Const: Encodable<E>,
@@ -576,13 +576,12 @@ where
576576
I::Mutability: Encodable<E>,
577577
I::Movability: Encodable<E>,
578578
I::PolyFnSig: Encodable<E>,
579-
I::ListBinderExistentialPredicate: Encodable<E>,
580-
I::BinderListTy: Encodable<E>,
581-
I::ListTy: Encodable<E>,
579+
I::BoundExistentialPredicates: Encodable<E>,
580+
I::Tys: Encodable<E>,
582581
I::AliasTy: Encodable<E>,
583582
I::ParamTy: Encodable<E>,
584583
I::BoundTy: Encodable<E>,
585-
I::PlaceholderType: Encodable<E>,
584+
I::PlaceholderTy: Encodable<E>,
586585
I::InferTy: Encodable<E>,
587586
I::PredicateKind: Encodable<E>,
588587
I::AllocId: Encodable<E>,
@@ -682,7 +681,7 @@ impl<I: Interner, D: TyDecoder<I = I>> Decodable<D> for TyKind<I>
682681
where
683682
I::ErrorGuaranteed: Decodable<D>,
684683
I::AdtDef: Decodable<D>,
685-
I::GenericArgsRef: Decodable<D>,
684+
I::GenericArgs: Decodable<D>,
686685
I::DefId: Decodable<D>,
687686
I::Ty: Decodable<D>,
688687
I::Const: Decodable<D>,
@@ -691,14 +690,13 @@ where
691690
I::Mutability: Decodable<D>,
692691
I::Movability: Decodable<D>,
693692
I::PolyFnSig: Decodable<D>,
694-
I::ListBinderExistentialPredicate: Decodable<D>,
695-
I::BinderListTy: Decodable<D>,
696-
I::ListTy: Decodable<D>,
693+
I::BoundExistentialPredicates: Decodable<D>,
694+
I::Tys: Decodable<D>,
697695
I::AliasTy: Decodable<D>,
698696
I::ParamTy: Decodable<D>,
699697
I::AliasTy: Decodable<D>,
700698
I::BoundTy: Decodable<D>,
701-
I::PlaceholderType: Decodable<D>,
699+
I::PlaceholderTy: Decodable<D>,
702700
I::InferTy: Decodable<D>,
703701
I::PredicateKind: Decodable<D>,
704702
I::AllocId: Decodable<D>,
@@ -748,21 +746,20 @@ impl<CTX: HashStableContext, I: Interner> HashStable<CTX> for TyKind<I>
748746
where
749747
I::AdtDef: HashStable<CTX>,
750748
I::DefId: HashStable<CTX>,
751-
I::GenericArgsRef: HashStable<CTX>,
749+
I::GenericArgs: HashStable<CTX>,
752750
I::Ty: HashStable<CTX>,
753751
I::Const: HashStable<CTX>,
754752
I::TypeAndMut: HashStable<CTX>,
755753
I::PolyFnSig: HashStable<CTX>,
756-
I::ListBinderExistentialPredicate: HashStable<CTX>,
754+
I::BoundExistentialPredicates: HashStable<CTX>,
757755
I::Region: HashStable<CTX>,
758756
I::Movability: HashStable<CTX>,
759757
I::Mutability: HashStable<CTX>,
760-
I::BinderListTy: HashStable<CTX>,
761-
I::ListTy: HashStable<CTX>,
758+
I::Tys: HashStable<CTX>,
762759
I::AliasTy: HashStable<CTX>,
763760
I::BoundTy: HashStable<CTX>,
764761
I::ParamTy: HashStable<CTX>,
765-
I::PlaceholderType: HashStable<CTX>,
762+
I::PlaceholderTy: HashStable<CTX>,
766763
I::InferTy: HashStable<CTX>,
767764
I::ErrorGuaranteed: HashStable<CTX>,
768765
{
@@ -1204,7 +1201,7 @@ pub enum RegionKind<I: Interner> {
12041201
ReStatic,
12051202

12061203
/// A region variable. Should not exist outside of type inference.
1207-
ReVar(I::RegionVid),
1204+
ReVar(I::InferRegion),
12081205

12091206
/// A placeholder region -- basically, the higher-ranked version of `ReFree`.
12101207
/// Should not exist outside of type inference.
@@ -1239,7 +1236,7 @@ where
12391236
I::EarlyBoundRegion: Copy,
12401237
I::BoundRegion: Copy,
12411238
I::FreeRegion: Copy,
1242-
I::RegionVid: Copy,
1239+
I::InferRegion: Copy,
12431240
I::PlaceholderRegion: Copy,
12441241
I::ErrorGuaranteed: Copy,
12451242
{
@@ -1379,7 +1376,7 @@ where
13791376
I::EarlyBoundRegion: Encodable<E>,
13801377
I::BoundRegion: Encodable<E>,
13811378
I::FreeRegion: Encodable<E>,
1382-
I::RegionVid: Encodable<E>,
1379+
I::InferRegion: Encodable<E>,
13831380
I::PlaceholderRegion: Encodable<E>,
13841381
{
13851382
fn encode(&self, e: &mut E) {
@@ -1414,7 +1411,7 @@ where
14141411
I::EarlyBoundRegion: Decodable<D>,
14151412
I::BoundRegion: Decodable<D>,
14161413
I::FreeRegion: Decodable<D>,
1417-
I::RegionVid: Decodable<D>,
1414+
I::InferRegion: Decodable<D>,
14181415
I::PlaceholderRegion: Decodable<D>,
14191416
I::ErrorGuaranteed: Decodable<D>,
14201417
{
@@ -1445,7 +1442,7 @@ where
14451442
I::EarlyBoundRegion: HashStable<CTX>,
14461443
I::BoundRegion: HashStable<CTX>,
14471444
I::FreeRegion: HashStable<CTX>,
1448-
I::RegionVid: HashStable<CTX>,
1445+
I::InferRegion: HashStable<CTX>,
14491446
I::PlaceholderRegion: HashStable<CTX>,
14501447
{
14511448
#[inline]

0 commit comments

Comments
 (0)