@@ -1906,12 +1906,18 @@ pub enum Place<'tcx> {
1906
1906
1907
1907
/// The `DefId` of a static, along with its normalized type (which is
1908
1908
/// stored to avoid requiring normalization when reading MIR).
1909
- #[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
1909
+ #[ derive( Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
1910
1910
pub struct Static < ' tcx > {
1911
1911
pub def_id : DefId ,
1912
1912
pub ty : Ty < ' tcx > ,
1913
1913
}
1914
1914
1915
+ BraceStructTypeFoldableImpl ! {
1916
+ impl <' tcx> TypeFoldable <' tcx> for Static <' tcx> {
1917
+ def_id, ty
1918
+ }
1919
+ }
1920
+
1915
1921
impl_stable_hash_for ! ( struct Static <' tcx> {
1916
1922
def_id,
1917
1923
ty
@@ -3285,23 +3291,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
3285
3291
}
3286
3292
}
3287
3293
3288
- impl < ' tcx > TypeFoldable < ' tcx > for Place < ' tcx > {
3289
- // TODO: this doesn't look correct!
3290
- fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F )
3291
- -> Result < Self , F :: Error >
3292
- {
3293
- match self {
3294
- & Place :: Projection ( ref p) => Ok ( Place :: Projection ( p. fold_with ( folder) ?) ) ,
3295
- _ => Ok ( self . clone ( ) ) ,
3296
- }
3297
- }
3298
-
3299
- fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> Result < ( ) , V :: Error > {
3300
- if let & Place :: Projection ( ref p) = self {
3301
- p. visit_with ( visitor)
3302
- } else {
3303
- Ok ( ( ) )
3304
- }
3294
+ EnumTypeFoldableImpl ! {
3295
+ impl <' tcx> TypeFoldable <' tcx> for Place <' tcx> {
3296
+ ( Place :: Local ) ( local) ,
3297
+ ( Place :: Static ) ( statik) ,
3298
+ ( Place :: Promoted ) ( promoted) ,
3299
+ ( Place :: Projection ) ( projection) ,
3305
3300
}
3306
3301
}
3307
3302
@@ -3426,8 +3421,6 @@ where
3426
3421
}
3427
3422
}
3428
3423
3429
- CloneTypeFoldableImpls ! { Field , }
3430
-
3431
3424
BraceStructTypeFoldableImpl ! {
3432
3425
impl <' tcx> TypeFoldable <' tcx> for Constant <' tcx> {
3433
3426
span, ty, user_ty, literal
0 commit comments