@@ -1906,12 +1906,18 @@ pub enum Place<'tcx> {
19061906
19071907/// The `DefId` of a static, along with its normalized type (which is
19081908/// 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 ) ]
19101910pub struct Static < ' tcx > {
19111911 pub def_id : DefId ,
19121912 pub ty : Ty < ' tcx > ,
19131913}
19141914
1915+ BraceStructTypeFoldableImpl ! {
1916+ impl <' tcx> TypeFoldable <' tcx> for Static <' tcx> {
1917+ def_id, ty
1918+ }
1919+ }
1920+
19151921impl_stable_hash_for ! ( struct Static <' tcx> {
19161922 def_id,
19171923 ty
@@ -3285,23 +3291,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
32853291 }
32863292}
32873293
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) ,
33053300 }
33063301}
33073302
@@ -3426,8 +3421,6 @@ where
34263421 }
34273422}
34283423
3429- CloneTypeFoldableImpls ! { Field , }
3430-
34313424BraceStructTypeFoldableImpl ! {
34323425 impl <' tcx> TypeFoldable <' tcx> for Constant <' tcx> {
34333426 span, ty, user_ty, literal
0 commit comments