File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ use rustc_session::getopts::{self, Matches};
4141use rustc_session:: lint:: { Lint , LintId } ;
4242use rustc_session:: output:: collect_crate_types;
4343use rustc_session:: { config, filesearch, EarlyDiagCtxt , Session } ;
44- use rustc_span:: def_id:: LOCAL_CRATE ;
4544use rustc_span:: source_map:: FileLoader ;
4645use rustc_span:: symbol:: sym;
4746use rustc_span:: FileName ;
@@ -448,21 +447,7 @@ fn run_compiler(
448447 return early_exit( ) ;
449448 }
450449
451- let linker = queries. codegen_and_build_linker( ) ?;
452-
453- // This must run after monomorphization so that all generic types
454- // have been instantiated.
455- if sess. opts. unstable_opts. print_type_sizes {
456- sess. code_stats. print_type_sizes( ) ;
457- }
458-
459- if sess. opts. unstable_opts. print_vtable_sizes {
460- let crate_name = queries. global_ctxt( ) ?. enter( |tcx| tcx. crate_name( LOCAL_CRATE ) ) ;
461-
462- sess. code_stats. print_vtable_sizes( crate_name) ;
463- }
464-
465- Ok ( Some ( linker) )
450+ Ok ( Some ( queries. codegen_and_build_linker( ) ?) )
466451 } ) ?;
467452
468453 // Linking is done outside the `compiler.enter()` so that the
Original file line number Diff line number Diff line change @@ -121,6 +121,18 @@ impl<'tcx> Queries<'tcx> {
121121 self . global_ctxt ( ) ?. enter ( |tcx| {
122122 let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ?;
123123
124+ // This must run after monomorphization so that all generic types
125+ // have been instantiated.
126+ if tcx. sess . opts . unstable_opts . print_type_sizes {
127+ tcx. sess . code_stats . print_type_sizes ( ) ;
128+ }
129+
130+ if tcx. sess . opts . unstable_opts . print_vtable_sizes {
131+ let crate_name = tcx. crate_name ( LOCAL_CRATE ) ;
132+
133+ tcx. sess . code_stats . print_vtable_sizes ( crate_name) ;
134+ }
135+
124136 Ok ( Linker {
125137 dep_graph : tcx. dep_graph . clone ( ) ,
126138 output_filenames : tcx. output_filenames ( ( ) ) . clone ( ) ,
You can’t perform that action at this time.
0 commit comments