@@ -6,28 +6,18 @@ use std::fmt::Debug;
66use std:: hash:: Hash ;
77use std:: iter;
88
9- use self :: SimplifiedTypeGen :: * ;
9+ use self :: SimplifiedType :: * ;
1010
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`.
1912#[ 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 {
2414 BoolSimplifiedType ,
2515 CharSimplifiedType ,
2616 IntSimplifiedType ( ty:: IntTy ) ,
2717 UintSimplifiedType ( ty:: UintTy ) ,
2818 FloatSimplifiedType ( ty:: FloatTy ) ,
29- AdtSimplifiedType ( D ) ,
30- ForeignSimplifiedType ( D ) ,
19+ AdtSimplifiedType ( DefId ) ,
20+ ForeignSimplifiedType ( DefId ) ,
3121 StrSimplifiedType ,
3222 ArraySimplifiedType ,
3323 SliceSimplifiedType ,
3828 /// A trait object, all of whose components are markers
3929 /// (e.g., `dyn Send + Sync`).
4030 MarkerTraitObjectSimplifiedType ,
41- TraitSimplifiedType ( D ) ,
42- ClosureSimplifiedType ( D ) ,
43- GeneratorSimplifiedType ( D ) ,
31+ TraitSimplifiedType ( DefId ) ,
32+ ClosureSimplifiedType ( DefId ) ,
33+ GeneratorSimplifiedType ( DefId ) ,
4434 GeneratorWitnessSimplifiedType ( usize ) ,
4535 FunctionSimplifiedType ( usize ) ,
4636 PlaceholderSimplifiedType ,
@@ -142,8 +132,8 @@ pub fn simplify_type<'tcx>(
142132 }
143133}
144134
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 > {
147137 match self {
148138 AdtSimplifiedType ( d)
149139 | ForeignSimplifiedType ( d)
@@ -153,36 +143,6 @@ impl<D: Copy + Debug + Eq> SimplifiedTypeGen<D> {
153143 _ => None ,
154144 }
155145 }
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- }
186146}
187147
188148/// Given generic arguments from an obligation and an impl,
0 commit comments