@@ -1729,15 +1729,15 @@ pub enum PlaceBase<'tcx> {
17291729}
17301730
17311731/// 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 ) ]
17331733pub struct Static < ' tcx > {
17341734 pub ty : Ty < ' tcx > ,
17351735 pub kind : StaticKind < ' tcx > ,
17361736 pub def_id : DefId ,
17371737}
17381738
17391739#[ derive(
1740- Clone , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable , RustcEncodable , RustcDecodable ,
1740+ Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable , RustcEncodable , RustcDecodable ,
17411741) ]
17421742pub enum StaticKind < ' tcx > {
17431743 Promoted ( Promoted , SubstsRef < ' tcx > ) ,
@@ -3221,13 +3221,63 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
32213221impl < ' tcx > TypeFoldable < ' tcx > for Place < ' tcx > {
32223222 fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
32233223 Place {
3224- base : self . base . clone ( ) ,
3224+ base : self . base . fold_with ( folder ) ,
32253225 projection : self . projection . fold_with ( folder) ,
32263226 }
32273227 }
32283228
32293229 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+ }
32313281 }
32323282}
32333283
0 commit comments