File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
compiler/rustc_interface/src Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,11 @@ impl Compiler {
347347 let queries = Queries :: new ( self ) ;
348348 let ret = f ( & queries) ;
349349
350+ // Finish the dep graph encoding before we call `save_dep_graph`.
351+ if let Err ( ( path, error) ) = queries. finish ( ) {
352+ self . sess . dcx ( ) . emit_fatal ( errors:: FailedWritingFile { path : & path, error } ) ;
353+ }
354+
350355 // NOTE: intentionally does not compute the global context if it hasn't been built yet,
351356 // since that likely means there was a parse error.
352357 if let Some ( Ok ( gcx) ) = & mut * queries. gcx . result . borrow_mut ( ) {
@@ -360,16 +365,13 @@ impl Compiler {
360365 }
361366
362367 self . sess . time ( "serialize_dep_graph" , || gcx. enter ( rustc_incremental:: save_dep_graph) ) ;
363- queries. dep_graph_serialized_tx . send ( ( ) ) . ok ( ) ;
364368 }
365369
370+ queries. dep_graph_serialized_tx . send ( ( ) ) . ok ( ) ;
371+
366372 // The timer's lifetime spans the dropping of `queries`, which contains
367373 // the global context.
368374 _timer = Some ( self . sess . timer ( "free_global_ctxt" ) ) ;
369- if let Err ( ( path, error) ) = queries. finish ( ) {
370- self . sess . dcx ( ) . emit_fatal ( errors:: FailedWritingFile { path : & path, error } ) ;
371- }
372-
373375 ret
374376 }
375377}
You can’t perform that action at this time.
0 commit comments