@@ -6,28 +6,18 @@ use std::fmt::Debug;
6
6
use std:: hash:: Hash ;
7
7
use std:: iter;
8
8
9
- use self :: SimplifiedTypeGen :: * ;
9
+ use self :: SimplifiedType :: * ;
10
10
11
- pub type SimplifiedType = SimplifiedTypeGen < DefId > ;
12
-
13
- /// See `simplify_type`
14
- ///
15
- /// Note that we keep this type generic over the type of identifier it uses
16
- /// because we sometimes need to use SimplifiedTypeGen values as stable sorting
17
- /// keys (in which case we use a DefPathHash as id-type) but in the general case
18
- /// the non-stable but fast to construct DefId-version is the better choice.
11
+ /// See `simplify_type`.
19
12
#[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , TyEncodable , TyDecodable , HashStable ) ]
20
- pub enum SimplifiedTypeGen < D >
21
- where
22
- D : Copy + Debug + Eq ,
23
- {
13
+ pub enum SimplifiedType {
24
14
BoolSimplifiedType ,
25
15
CharSimplifiedType ,
26
16
IntSimplifiedType ( ty:: IntTy ) ,
27
17
UintSimplifiedType ( ty:: UintTy ) ,
28
18
FloatSimplifiedType ( ty:: FloatTy ) ,
29
- AdtSimplifiedType ( D ) ,
30
- ForeignSimplifiedType ( D ) ,
19
+ AdtSimplifiedType ( DefId ) ,
20
+ ForeignSimplifiedType ( DefId ) ,
31
21
StrSimplifiedType ,
32
22
ArraySimplifiedType ,
33
23
SliceSimplifiedType ,
38
28
/// A trait object, all of whose components are markers
39
29
/// (e.g., `dyn Send + Sync`).
40
30
MarkerTraitObjectSimplifiedType ,
41
- TraitSimplifiedType ( D ) ,
42
- ClosureSimplifiedType ( D ) ,
43
- GeneratorSimplifiedType ( D ) ,
31
+ TraitSimplifiedType ( DefId ) ,
32
+ ClosureSimplifiedType ( DefId ) ,
33
+ GeneratorSimplifiedType ( DefId ) ,
44
34
GeneratorWitnessSimplifiedType ( usize ) ,
45
35
FunctionSimplifiedType ( usize ) ,
46
36
PlaceholderSimplifiedType ,
@@ -142,8 +132,8 @@ pub fn simplify_type<'tcx>(
142
132
}
143
133
}
144
134
145
- impl < D : Copy + Debug + Eq > SimplifiedTypeGen < D > {
146
- pub fn def ( self ) -> Option < D > {
135
+ impl SimplifiedType {
136
+ pub fn def ( self ) -> Option < DefId > {
147
137
match self {
148
138
AdtSimplifiedType ( d)
149
139
| ForeignSimplifiedType ( d)
@@ -153,36 +143,6 @@ impl<D: Copy + Debug + Eq> SimplifiedTypeGen<D> {
153
143
_ => None ,
154
144
}
155
145
}
156
-
157
- pub fn map_def < U , F > ( self , map : F ) -> SimplifiedTypeGen < U >
158
- where
159
- F : Fn ( D ) -> U ,
160
- U : Copy + Debug + Eq ,
161
- {
162
- match self {
163
- BoolSimplifiedType => BoolSimplifiedType ,
164
- CharSimplifiedType => CharSimplifiedType ,
165
- IntSimplifiedType ( t) => IntSimplifiedType ( t) ,
166
- UintSimplifiedType ( t) => UintSimplifiedType ( t) ,
167
- FloatSimplifiedType ( t) => FloatSimplifiedType ( t) ,
168
- AdtSimplifiedType ( d) => AdtSimplifiedType ( map ( d) ) ,
169
- ForeignSimplifiedType ( d) => ForeignSimplifiedType ( map ( d) ) ,
170
- StrSimplifiedType => StrSimplifiedType ,
171
- ArraySimplifiedType => ArraySimplifiedType ,
172
- SliceSimplifiedType => SliceSimplifiedType ,
173
- RefSimplifiedType ( m) => RefSimplifiedType ( m) ,
174
- PtrSimplifiedType ( m) => PtrSimplifiedType ( m) ,
175
- NeverSimplifiedType => NeverSimplifiedType ,
176
- MarkerTraitObjectSimplifiedType => MarkerTraitObjectSimplifiedType ,
177
- TupleSimplifiedType ( n) => TupleSimplifiedType ( n) ,
178
- TraitSimplifiedType ( d) => TraitSimplifiedType ( map ( d) ) ,
179
- ClosureSimplifiedType ( d) => ClosureSimplifiedType ( map ( d) ) ,
180
- GeneratorSimplifiedType ( d) => GeneratorSimplifiedType ( map ( d) ) ,
181
- GeneratorWitnessSimplifiedType ( n) => GeneratorWitnessSimplifiedType ( n) ,
182
- FunctionSimplifiedType ( n) => FunctionSimplifiedType ( n) ,
183
- PlaceholderSimplifiedType => PlaceholderSimplifiedType ,
184
- }
185
- }
186
146
}
187
147
188
148
/// Given generic arguments from an obligation and an impl,
0 commit comments