@@ -1729,15 +1729,15 @@ pub enum PlaceBase<'tcx> {
1729
1729
}
1730
1730
1731
1731
/// We store the normalized type to avoid requiring normalization when reading MIR
1732
- #[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
1732
+ #[ derive( Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
1733
1733
pub struct Static < ' tcx > {
1734
1734
pub ty : Ty < ' tcx > ,
1735
1735
pub kind : StaticKind < ' tcx > ,
1736
1736
pub def_id : DefId ,
1737
1737
}
1738
1738
1739
1739
#[ derive(
1740
- Clone , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable , RustcEncodable , RustcDecodable ,
1740
+ Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable , RustcEncodable , RustcDecodable ,
1741
1741
) ]
1742
1742
pub enum StaticKind < ' tcx > {
1743
1743
Promoted ( Promoted , SubstsRef < ' tcx > ) ,
@@ -3221,13 +3221,63 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
3221
3221
impl < ' tcx > TypeFoldable < ' tcx > for Place < ' tcx > {
3222
3222
fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
3223
3223
Place {
3224
- base : self . base . clone ( ) ,
3224
+ base : self . base . fold_with ( folder ) ,
3225
3225
projection : self . projection . fold_with ( folder) ,
3226
3226
}
3227
3227
}
3228
3228
3229
3229
fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
3230
- self . projection . visit_with ( visitor)
3230
+ self . base . visit_with ( visitor) || self . projection . visit_with ( visitor)
3231
+ }
3232
+ }
3233
+
3234
+ impl < ' tcx > TypeFoldable < ' tcx > for PlaceBase < ' tcx > {
3235
+ fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
3236
+ match self {
3237
+ PlaceBase :: Local ( local) => PlaceBase :: Local ( local. fold_with ( folder) ) ,
3238
+ PlaceBase :: Static ( static_) => PlaceBase :: Static ( static_. fold_with ( folder) ) ,
3239
+ }
3240
+ }
3241
+
3242
+ fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
3243
+ match self {
3244
+ PlaceBase :: Local ( local) => local. visit_with ( visitor) ,
3245
+ PlaceBase :: Static ( static_) => ( * * static_) . visit_with ( visitor) ,
3246
+ }
3247
+ }
3248
+ }
3249
+
3250
+ impl < ' tcx > TypeFoldable < ' tcx > for Static < ' tcx > {
3251
+ fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
3252
+ Static {
3253
+ ty : self . ty . fold_with ( folder) ,
3254
+ kind : self . kind . fold_with ( folder) ,
3255
+ def_id : self . def_id ,
3256
+ }
3257
+ }
3258
+
3259
+ fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
3260
+ let Static { ty, kind, def_id : _ } = self ;
3261
+
3262
+ ty. visit_with ( visitor) || kind. visit_with ( visitor)
3263
+ }
3264
+ }
3265
+
3266
+ impl < ' tcx > TypeFoldable < ' tcx > for StaticKind < ' tcx > {
3267
+ fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
3268
+ match self {
3269
+ StaticKind :: Promoted ( promoted, substs) =>
3270
+ StaticKind :: Promoted ( promoted. fold_with ( folder) , substs. fold_with ( folder) ) ,
3271
+ StaticKind :: Static => StaticKind :: Static
3272
+ }
3273
+ }
3274
+
3275
+ fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
3276
+ match self {
3277
+ StaticKind :: Promoted ( promoted, substs) =>
3278
+ promoted. visit_with ( visitor) || substs. visit_with ( visitor) ,
3279
+ StaticKind :: Static => { false }
3280
+ }
3231
3281
}
3232
3282
}
3233
3283
0 commit comments