File tree 1 file changed +15
-6
lines changed
compiler/rustc_mir/src/monomorphize/partitioning
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -239,17 +239,22 @@ where
239
239
I : Iterator < Item = & ' a CodegenUnit < ' tcx > > ,
240
240
' tcx : ' a ,
241
241
{
242
- if cfg ! ( debug_assertions) {
243
- debug ! ( "{}" , label) ;
242
+ let dump = move || {
243
+ use std:: fmt:: Write ;
244
+
245
+ let s = & mut String :: new ( ) ;
246
+ let _ = writeln ! ( s, "{}" , label) ;
244
247
for cgu in cgus {
245
- debug ! ( "CodegenUnit {} estimated size {} :" , cgu. name( ) , cgu. size_estimate( ) ) ;
248
+ let _ =
249
+ writeln ! ( s, "CodegenUnit {} estimated size {} :" , cgu. name( ) , cgu. size_estimate( ) ) ;
246
250
247
251
for ( mono_item, linkage) in cgu. items ( ) {
248
252
let symbol_name = mono_item. symbol_name ( tcx) . name ;
249
253
let symbol_hash_start = symbol_name. rfind ( 'h' ) ;
250
254
let symbol_hash = symbol_hash_start. map_or ( "<no hash>" , |i| & symbol_name[ i..] ) ;
251
255
252
- debug ! (
256
+ let _ = writeln ! (
257
+ s,
253
258
" - {} [{:?}] [{}] estimated size {}" ,
254
259
mono_item,
255
260
linkage,
@@ -258,9 +263,13 @@ where
258
263
) ;
259
264
}
260
265
261
- debug ! ( "" ) ;
266
+ let _ = writeln ! ( s , "" ) ;
262
267
}
263
- }
268
+
269
+ std:: mem:: take ( s)
270
+ } ;
271
+
272
+ debug ! ( "{}" , dump( ) ) ;
264
273
}
265
274
266
275
#[ inline( never) ] // give this a place in the profiler
You can’t perform that action at this time.
0 commit comments