44
55use crate :: hir:: def:: { CtorKind , Namespace } ;
66use crate :: hir:: def_id:: DefId ;
7- use crate :: hir:: { self , HirId , InlineAsm as HirInlineAsm } ;
7+ use crate :: hir:: { self , InlineAsm as HirInlineAsm } ;
88use crate :: mir:: interpret:: { ConstValue , InterpError , Scalar } ;
99use crate :: mir:: visit:: MirVisitable ;
1010use rustc_apfloat:: ieee:: { Double , Single } ;
@@ -138,16 +138,20 @@ pub struct Mir<'tcx> {
138138 /// If this MIR was built for a constant, this will be 0.
139139 pub arg_count : usize ,
140140
141- /// Names and capture modes of all the closure upvars, assuming
142- /// the first argument is either the closure or a reference to it.
143- pub upvar_decls : Vec < UpvarDecl > ,
144-
145141 /// Mark an argument local (which must be a tuple) as getting passed as
146142 /// its individual components at the LLVM level.
147143 ///
148144 /// This is used for the "rust-call" ABI.
149145 pub spread_arg : Option < Local > ,
150146
147+ /// Names and capture modes of all the closure upvars, assuming
148+ /// the first argument is either the closure or a reference to it.
149+ // NOTE(eddyb) This is *strictly* a temporary hack for codegen
150+ // debuginfo generation, and will be removed at some point.
151+ // Do **NOT** use it for anything else, upvar information should not be
152+ // in the MIR, please rely on local crate HIR or other side-channels.
153+ pub __upvar_debuginfo_codegen_only_do_not_use : Vec < UpvarDebuginfo > ,
154+
151155 /// Mark this MIR of a const context other than const functions as having converted a `&&` or
152156 /// `||` expression into `&` or `|` respectively. This is problematic because if we ever stop
153157 /// this conversion from happening and use short circuiting, we will cause the following code
@@ -173,7 +177,7 @@ impl<'tcx> Mir<'tcx> {
173177 local_decls : LocalDecls < ' tcx > ,
174178 user_type_annotations : CanonicalUserTypeAnnotations < ' tcx > ,
175179 arg_count : usize ,
176- upvar_decls : Vec < UpvarDecl > ,
180+ __upvar_debuginfo_codegen_only_do_not_use : Vec < UpvarDebuginfo > ,
177181 span : Span ,
178182 control_flow_destroyed : Vec < ( Span , String ) > ,
179183 ) -> Self {
@@ -197,7 +201,7 @@ impl<'tcx> Mir<'tcx> {
197201 local_decls,
198202 user_type_annotations,
199203 arg_count,
200- upvar_decls ,
204+ __upvar_debuginfo_codegen_only_do_not_use ,
201205 spread_arg : None ,
202206 span,
203207 cache : cache:: Cache :: new ( ) ,
@@ -431,7 +435,7 @@ impl_stable_hash_for!(struct Mir<'tcx> {
431435 local_decls,
432436 user_type_annotations,
433437 arg_count,
434- upvar_decls ,
438+ __upvar_debuginfo_codegen_only_do_not_use ,
435439 spread_arg,
436440 control_flow_destroyed,
437441 span,
@@ -983,16 +987,11 @@ impl<'tcx> LocalDecl<'tcx> {
983987
984988/// A closure capture, with its name and mode.
985989#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
986- pub struct UpvarDecl {
990+ pub struct UpvarDebuginfo {
987991 pub debug_name : Name ,
988992
989- /// `HirId` of the captured variable
990- pub var_hir_id : ClearCrossCrate < HirId > ,
991-
992993 /// If true, the capture is behind a reference.
993994 pub by_ref : bool ,
994-
995- pub mutability : Mutability ,
996995}
997996
998997///////////////////////////////////////////////////////////////////////////
@@ -3156,7 +3155,7 @@ CloneTypeFoldableAndLiftImpls! {
31563155 MirPhase ,
31573156 Mutability ,
31583157 SourceInfo ,
3159- UpvarDecl ,
3158+ UpvarDebuginfo ,
31603159 FakeReadCause ,
31613160 RetagKind ,
31623161 SourceScope ,
@@ -3178,7 +3177,7 @@ BraceStructTypeFoldableImpl! {
31783177 local_decls,
31793178 user_type_annotations,
31803179 arg_count,
3181- upvar_decls ,
3180+ __upvar_debuginfo_codegen_only_do_not_use ,
31823181 spread_arg,
31833182 control_flow_destroyed,
31843183 span,
0 commit comments