File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
compiler/rustc_mir/src/monomorphize/partitioning Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -239,17 +239,22 @@ where
239239 I : Iterator < Item = & ' a CodegenUnit < ' tcx > > ,
240240 ' tcx : ' a ,
241241{
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) ;
244247 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( ) ) ;
246250
247251 for ( mono_item, linkage) in cgu. items ( ) {
248252 let symbol_name = mono_item. symbol_name ( tcx) . name ;
249253 let symbol_hash_start = symbol_name. rfind ( 'h' ) ;
250254 let symbol_hash = symbol_hash_start. map_or ( "<no hash>" , |i| & symbol_name[ i..] ) ;
251255
252- debug ! (
256+ let _ = writeln ! (
257+ s,
253258 " - {} [{:?}] [{}] estimated size {}" ,
254259 mono_item,
255260 linkage,
@@ -258,9 +263,13 @@ where
258263 ) ;
259264 }
260265
261- debug ! ( "" ) ;
266+ let _ = writeln ! ( s , "" ) ;
262267 }
263- }
268+
269+ std:: mem:: take ( s)
270+ } ;
271+
272+ debug ! ( "{}" , dump( ) ) ;
264273}
265274
266275#[ inline( never) ] // give this a place in the profiler
You can’t perform that action at this time.
0 commit comments