@@ -104,10 +104,6 @@ pub struct Body<'tcx> {
104
104
/// and used for debuginfo. Indexed by a `SourceScope`.
105
105
pub source_scopes : IndexVec < SourceScope , SourceScopeData > ,
106
106
107
- /// Crate-local information for each source scope, that can't (and
108
- /// needn't) be tracked across crates.
109
- pub source_scope_local_data : ClearCrossCrate < IndexVec < SourceScope , SourceScopeLocalData > > ,
110
-
111
107
/// The yield type of the function, if it is a generator.
112
108
pub yield_ty : Option < Ty < ' tcx > > ,
113
109
@@ -167,7 +163,6 @@ impl<'tcx> Body<'tcx> {
167
163
pub fn new (
168
164
basic_blocks : IndexVec < BasicBlock , BasicBlockData < ' tcx > > ,
169
165
source_scopes : IndexVec < SourceScope , SourceScopeData > ,
170
- source_scope_local_data : ClearCrossCrate < IndexVec < SourceScope , SourceScopeLocalData > > ,
171
166
local_decls : LocalDecls < ' tcx > ,
172
167
user_type_annotations : CanonicalUserTypeAnnotations < ' tcx > ,
173
168
arg_count : usize ,
@@ -188,7 +183,6 @@ impl<'tcx> Body<'tcx> {
188
183
phase : MirPhase :: Build ,
189
184
basic_blocks,
190
185
source_scopes,
191
- source_scope_local_data,
192
186
yield_ty : None ,
193
187
generator_drop : None ,
194
188
generator_layout : None ,
@@ -435,6 +429,13 @@ pub enum ClearCrossCrate<T> {
435
429
}
436
430
437
431
impl < T > ClearCrossCrate < T > {
432
+ pub fn as_ref ( & ' a self ) -> ClearCrossCrate < & ' a T > {
433
+ match self {
434
+ ClearCrossCrate :: Clear => ClearCrossCrate :: Clear ,
435
+ ClearCrossCrate :: Set ( v) => ClearCrossCrate :: Set ( v) ,
436
+ }
437
+ }
438
+
438
439
pub fn assert_crate_local ( self ) -> T {
439
440
match self {
440
441
ClearCrossCrate :: Clear => bug ! ( "unwrapping cross-crate data" ) ,
@@ -2027,6 +2028,10 @@ rustc_index::newtype_index! {
2027
2028
pub struct SourceScopeData {
2028
2029
pub span : Span ,
2029
2030
pub parent_scope : Option < SourceScope > ,
2031
+
2032
+ /// Crate-local information for this source scope, that can't (and
2033
+ /// needn't) be tracked across crates.
2034
+ pub local_data : ClearCrossCrate < SourceScopeLocalData > ,
2030
2035
}
2031
2036
2032
2037
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
@@ -2308,10 +2313,14 @@ impl<'tcx> Debug for Rvalue<'tcx> {
2308
2313
}
2309
2314
}
2310
2315
2311
- AggregateKind :: Closure ( def_id, _ ) => ty:: tls:: with ( |tcx| {
2316
+ AggregateKind :: Closure ( def_id, substs ) => ty:: tls:: with ( |tcx| {
2312
2317
if let Some ( hir_id) = tcx. hir ( ) . as_local_hir_id ( def_id) {
2313
2318
let name = if tcx. sess . opts . debugging_opts . span_free_formats {
2314
- format ! ( "[closure@{:?}]" , hir_id)
2319
+ let substs = tcx. lift ( & substs) . unwrap ( ) ;
2320
+ format ! (
2321
+ "[closure@{}]" ,
2322
+ tcx. def_path_str_with_substs( def_id, substs) ,
2323
+ )
2315
2324
} else {
2316
2325
format ! ( "[closure@{:?}]" , tcx. hir( ) . span( hir_id) )
2317
2326
} ;
0 commit comments