@@ -20,6 +20,7 @@ use rustc_span::symbol::sym;
2020use std:: any:: Any ;
2121use std:: cell:: { Ref , RefCell , RefMut } ;
2222use std:: rc:: Rc ;
23+ use std:: sync:: Arc ;
2324
2425/// Represent the result of a query.
2526///
@@ -214,7 +215,7 @@ impl<'tcx> Queries<'tcx> {
214215 pub fn global_ctxt ( & ' tcx self ) -> Result < & Query < QueryContext < ' tcx > > > {
215216 self . global_ctxt . compute ( || {
216217 let crate_name = self . crate_name ( ) ?. peek ( ) . clone ( ) ;
217- let outputs = self . prepare_outputs ( ) ?. peek ( ) . clone ( ) ;
218+ let outputs = self . prepare_outputs ( ) ?. take ( ) ;
218219 let dep_graph = self . dep_graph ( ) ?. peek ( ) . clone ( ) ;
219220 let ( krate, resolver, lint_store) = self . expansion ( ) ?. take ( ) ;
220221 Ok ( passes:: create_global_ctxt (
@@ -235,7 +236,6 @@ impl<'tcx> Queries<'tcx> {
235236
236237 pub fn ongoing_codegen ( & ' tcx self ) -> Result < & Query < Box < dyn Any > > > {
237238 self . ongoing_codegen . compute ( || {
238- let outputs = self . prepare_outputs ( ) ?;
239239 self . global_ctxt ( ) ?. peek_mut ( ) . enter ( |tcx| {
240240 tcx. analysis ( ( ) ) . ok ( ) ;
241241
@@ -249,7 +249,7 @@ impl<'tcx> Queries<'tcx> {
249249 // Hook for UI tests.
250250 Self :: check_for_rustc_errors_attr ( tcx) ;
251251
252- Ok ( passes:: start_codegen ( & * * * self . codegen_backend ( ) , tcx, & * outputs . peek ( ) ) )
252+ Ok ( passes:: start_codegen ( & * * * self . codegen_backend ( ) , tcx) )
253253 } )
254254 } )
255255 }
@@ -293,8 +293,10 @@ impl<'tcx> Queries<'tcx> {
293293 let codegen_backend = self . codegen_backend ( ) . clone ( ) ;
294294
295295 let dep_graph = self . dep_graph ( ) ?. peek ( ) . clone ( ) ;
296- let prepare_outputs = self . prepare_outputs ( ) ?. take ( ) ;
297- let crate_hash = self . global_ctxt ( ) ?. peek_mut ( ) . enter ( |tcx| tcx. crate_hash ( LOCAL_CRATE ) ) ;
296+ let ( crate_hash, prepare_outputs) = self
297+ . global_ctxt ( ) ?
298+ . peek_mut ( )
299+ . enter ( |tcx| ( tcx. crate_hash ( LOCAL_CRATE ) , tcx. output_filenames ( ( ) ) . clone ( ) ) ) ;
298300 let ongoing_codegen = self . ongoing_codegen ( ) ?. take ( ) ;
299301
300302 Ok ( Linker {
@@ -316,7 +318,7 @@ pub struct Linker {
316318
317319 // compilation outputs
318320 dep_graph : DepGraph ,
319- prepare_outputs : OutputFilenames ,
321+ prepare_outputs : Arc < OutputFilenames > ,
320322 crate_hash : Svh ,
321323 ongoing_codegen : Box < dyn Any > ,
322324}
0 commit comments