4
4
5
5
use crate :: hir:: def:: { CtorKind , Namespace } ;
6
6
use crate :: hir:: def_id:: DefId ;
7
- use crate :: hir:: { self , HirId , InlineAsm as HirInlineAsm } ;
7
+ use crate :: hir:: { self , InlineAsm as HirInlineAsm } ;
8
8
use crate :: mir:: interpret:: { ConstValue , InterpError , Scalar } ;
9
9
use crate :: mir:: visit:: MirVisitable ;
10
10
use rustc_apfloat:: ieee:: { Double , Single } ;
@@ -138,16 +138,20 @@ pub struct Mir<'tcx> {
138
138
/// If this MIR was built for a constant, this will be 0.
139
139
pub arg_count : usize ,
140
140
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
-
145
141
/// Mark an argument local (which must be a tuple) as getting passed as
146
142
/// its individual components at the LLVM level.
147
143
///
148
144
/// This is used for the "rust-call" ABI.
149
145
pub spread_arg : Option < Local > ,
150
146
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
+
151
155
/// Mark this MIR of a const context other than const functions as having converted a `&&` or
152
156
/// `||` expression into `&` or `|` respectively. This is problematic because if we ever stop
153
157
/// this conversion from happening and use short circuiting, we will cause the following code
@@ -173,7 +177,7 @@ impl<'tcx> Mir<'tcx> {
173
177
local_decls : LocalDecls < ' tcx > ,
174
178
user_type_annotations : CanonicalUserTypeAnnotations < ' tcx > ,
175
179
arg_count : usize ,
176
- upvar_decls : Vec < UpvarDecl > ,
180
+ __upvar_debuginfo_codegen_only_do_not_use : Vec < UpvarDebuginfo > ,
177
181
span : Span ,
178
182
control_flow_destroyed : Vec < ( Span , String ) > ,
179
183
) -> Self {
@@ -197,7 +201,7 @@ impl<'tcx> Mir<'tcx> {
197
201
local_decls,
198
202
user_type_annotations,
199
203
arg_count,
200
- upvar_decls ,
204
+ __upvar_debuginfo_codegen_only_do_not_use ,
201
205
spread_arg : None ,
202
206
span,
203
207
cache : cache:: Cache :: new ( ) ,
@@ -431,7 +435,7 @@ impl_stable_hash_for!(struct Mir<'tcx> {
431
435
local_decls,
432
436
user_type_annotations,
433
437
arg_count,
434
- upvar_decls ,
438
+ __upvar_debuginfo_codegen_only_do_not_use ,
435
439
spread_arg,
436
440
control_flow_destroyed,
437
441
span,
@@ -983,16 +987,11 @@ impl<'tcx> LocalDecl<'tcx> {
983
987
984
988
/// A closure capture, with its name and mode.
985
989
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
986
- pub struct UpvarDecl {
990
+ pub struct UpvarDebuginfo {
987
991
pub debug_name : Name ,
988
992
989
- /// `HirId` of the captured variable
990
- pub var_hir_id : ClearCrossCrate < HirId > ,
991
-
992
993
/// If true, the capture is behind a reference.
993
994
pub by_ref : bool ,
994
-
995
- pub mutability : Mutability ,
996
995
}
997
996
998
997
///////////////////////////////////////////////////////////////////////////
@@ -3156,7 +3155,7 @@ CloneTypeFoldableAndLiftImpls! {
3156
3155
MirPhase ,
3157
3156
Mutability ,
3158
3157
SourceInfo ,
3159
- UpvarDecl ,
3158
+ UpvarDebuginfo ,
3160
3159
FakeReadCause ,
3161
3160
RetagKind ,
3162
3161
SourceScope ,
@@ -3178,7 +3177,7 @@ BraceStructTypeFoldableImpl! {
3178
3177
local_decls,
3179
3178
user_type_annotations,
3180
3179
arg_count,
3181
- upvar_decls ,
3180
+ __upvar_debuginfo_codegen_only_do_not_use ,
3182
3181
spread_arg,
3183
3182
control_flow_destroyed,
3184
3183
span,
0 commit comments