@@ -2994,10 +2994,29 @@ pub struct UnsafetyCheckResult {
2994
2994
pub unsafe_blocks : Lrc < [ ( hir:: HirId , bool ) ] > ,
2995
2995
}
2996
2996
2997
+ newtype_index ! {
2998
+ pub struct GeneratorField {
2999
+ derive [ HashStable ]
3000
+ DEBUG_FORMAT = "_{}" ,
3001
+ }
3002
+ }
3003
+
2997
3004
/// The layout of generator state
2998
3005
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
2999
3006
pub struct GeneratorLayout < ' tcx > {
3000
- pub variant_fields : IndexVec < VariantIdx , IndexVec < Field , LocalDecl < ' tcx > > > ,
3007
+ /// The type of every local stored inside the generator.
3008
+ pub field_tys : IndexVec < GeneratorField , Ty < ' tcx > > ,
3009
+
3010
+ /// Which of the above fields are in each variant. Note that one field may
3011
+ /// be stored in multiple variants.
3012
+ pub variant_fields : IndexVec < VariantIdx , IndexVec < Field , GeneratorField > > ,
3013
+
3014
+ /// Names and scopes of all the stored generator locals.
3015
+ /// NOTE(tmandry) This is *strictly* a temporary hack for codegen
3016
+ /// debuginfo generation, and will be removed at some point.
3017
+ /// Do **NOT** use it for anything else, local information should not be
3018
+ /// in the MIR, please rely on local crate HIR or other side-channels.
3019
+ pub __local_debuginfo_codegen_only_do_not_use : IndexVec < GeneratorField , LocalDecl < ' tcx > > ,
3001
3020
}
3002
3021
3003
3022
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
@@ -3186,7 +3205,9 @@ BraceStructTypeFoldableImpl! {
3186
3205
3187
3206
BraceStructTypeFoldableImpl ! {
3188
3207
impl <' tcx> TypeFoldable <' tcx> for GeneratorLayout <' tcx> {
3189
- variant_fields
3208
+ field_tys,
3209
+ variant_fields,
3210
+ __local_debuginfo_codegen_only_do_not_use,
3190
3211
}
3191
3212
}
3192
3213
@@ -3561,6 +3582,15 @@ impl<'tcx> TypeFoldable<'tcx> for Field {
3561
3582
}
3562
3583
}
3563
3584
3585
+ impl < ' tcx > TypeFoldable < ' tcx > for GeneratorField {
3586
+ fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , _: & mut F ) -> Self {
3587
+ * self
3588
+ }
3589
+ fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> bool {
3590
+ false
3591
+ }
3592
+ }
3593
+
3564
3594
impl < ' tcx > TypeFoldable < ' tcx > for Constant < ' tcx > {
3565
3595
fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
3566
3596
Constant {
0 commit comments