File tree 3 files changed +16
-16
lines changed
compiler/rustc_interface/src
3 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -1017,13 +1017,6 @@ pub fn start_codegen<'tcx>(
1017
1017
tcx. sess . time ( "assert_dep_graph" , || rustc_incremental:: assert_dep_graph ( tcx) ) ;
1018
1018
tcx. sess . time ( "serialize_dep_graph" , || rustc_incremental:: save_dep_graph ( tcx) ) ;
1019
1019
1020
- // We assume that no queries are run past here. If there are new queries
1021
- // after this point, they'll show up as "<unknown>" in self-profiling data.
1022
- {
1023
- let _prof_timer = tcx. prof . generic_activity ( "self_profile_alloc_query_strings" ) ;
1024
- tcx. alloc_self_profile_query_strings ( ) ;
1025
- }
1026
-
1027
1020
info ! ( "Post-codegen\n {:?}" , tcx. debug_stats( ) ) ;
1028
1021
1029
1022
if tcx. sess . opts . output_types . contains_key ( & OutputType :: Mir ) {
Original file line number Diff line number Diff line change @@ -417,9 +417,19 @@ impl Compiler {
417
417
let queries = Queries :: new ( & self ) ;
418
418
let ret = f ( & queries) ;
419
419
420
- if self . session ( ) . opts . debugging_opts . query_stats {
421
- if let Ok ( gcx) = queries. global_ctxt ( ) {
422
- gcx. peek_mut ( ) . print_stats ( ) ;
420
+ // NOTE: intentionally does not compute the global context if it hasn't been built yet,
421
+ // since that likely means there was a parse error.
422
+ if let Some ( Ok ( gcx) ) = & mut * queries. global_ctxt . result . borrow_mut ( ) {
423
+ // We assume that no queries are run past here. If there are new queries
424
+ // after this point, they'll show up as "<unknown>" in self-profiling data.
425
+ {
426
+ let _prof_timer =
427
+ queries. session ( ) . prof . generic_activity ( "self_profile_alloc_query_strings" ) ;
428
+ gcx. enter ( |tcx| tcx. alloc_self_profile_query_strings ( ) ) ;
429
+ }
430
+
431
+ if self . session ( ) . opts . debugging_opts . query_stats {
432
+ gcx. print_stats ( ) ;
423
433
}
424
434
}
425
435
Original file line number Diff line number Diff line change @@ -539,7 +539,7 @@ fn main_options(options: config::Options) -> MainResult {
539
539
sess. fatal ( "Compilation failed, aborting rustdoc" ) ;
540
540
}
541
541
542
- let mut global_ctxt = abort_on_err ( queries. global_ctxt ( ) , sess) . take ( ) ;
542
+ let mut global_ctxt = abort_on_err ( queries. global_ctxt ( ) , sess) . peek_mut ( ) ;
543
543
544
544
global_ctxt. enter ( |tcx| {
545
545
let ( mut krate, render_info, render_opts) = sess. time ( "run_global_ctxt" , || {
@@ -568,7 +568,7 @@ fn main_options(options: config::Options) -> MainResult {
568
568
info ! ( "going to format" ) ;
569
569
let ( error_format, edition, debugging_options) = diag_opts;
570
570
let diag = core:: new_handler ( error_format, None , & debugging_options) ;
571
- let main_result = match output_format {
571
+ match output_format {
572
572
None | Some ( config:: OutputFormat :: Html ) => sess. time ( "render_html" , || {
573
573
run_renderer :: < html:: render:: Context < ' _ > > (
574
574
krate,
@@ -589,10 +589,7 @@ fn main_options(options: config::Options) -> MainResult {
589
589
tcx,
590
590
)
591
591
} ) ,
592
- } ;
593
- // NOTE: this is normally called in codegen, but rustdoc never goes to codegen.
594
- tcx. alloc_self_profile_query_strings ( ) ;
595
- main_result
592
+ }
596
593
} )
597
594
} )
598
595
} )
You can’t perform that action at this time.
0 commit comments