@@ -104,10 +104,6 @@ pub struct Body<'tcx> {
104104 /// and used for debuginfo. Indexed by a `SourceScope`.
105105 pub source_scopes : IndexVec < SourceScope , SourceScopeData > ,
106106
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-
111107 /// The yield type of the function, if it is a generator.
112108 pub yield_ty : Option < Ty < ' tcx > > ,
113109
@@ -167,7 +163,6 @@ impl<'tcx> Body<'tcx> {
167163 pub fn new (
168164 basic_blocks : IndexVec < BasicBlock , BasicBlockData < ' tcx > > ,
169165 source_scopes : IndexVec < SourceScope , SourceScopeData > ,
170- source_scope_local_data : ClearCrossCrate < IndexVec < SourceScope , SourceScopeLocalData > > ,
171166 local_decls : LocalDecls < ' tcx > ,
172167 user_type_annotations : CanonicalUserTypeAnnotations < ' tcx > ,
173168 arg_count : usize ,
@@ -188,7 +183,6 @@ impl<'tcx> Body<'tcx> {
188183 phase : MirPhase :: Build ,
189184 basic_blocks,
190185 source_scopes,
191- source_scope_local_data,
192186 yield_ty : None ,
193187 generator_drop : None ,
194188 generator_layout : None ,
@@ -435,6 +429,13 @@ pub enum ClearCrossCrate<T> {
435429}
436430
437431impl < 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+
438439 pub fn assert_crate_local ( self ) -> T {
439440 match self {
440441 ClearCrossCrate :: Clear => bug ! ( "unwrapping cross-crate data" ) ,
@@ -2027,6 +2028,10 @@ rustc_index::newtype_index! {
20272028pub struct SourceScopeData {
20282029 pub span : Span ,
20292030 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 > ,
20302035}
20312036
20322037#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
@@ -2308,10 +2313,14 @@ impl<'tcx> Debug for Rvalue<'tcx> {
23082313 }
23092314 }
23102315
2311- AggregateKind :: Closure ( def_id, _ ) => ty:: tls:: with ( |tcx| {
2316+ AggregateKind :: Closure ( def_id, substs ) => ty:: tls:: with ( |tcx| {
23122317 if let Some ( hir_id) = tcx. hir ( ) . as_local_hir_id ( def_id) {
23132318 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+ )
23152324 } else {
23162325 format ! ( "[closure@{:?}]" , tcx. hir( ) . span( hir_id) )
23172326 } ;
0 commit comments