@@ -101,9 +101,10 @@ impl<'tcx> Queries<'tcx> {
101101 }
102102 }
103103
104- fn session ( & self ) -> & Lrc < Session > {
104+ fn session ( & self ) -> & Session {
105105 & self . compiler . sess
106106 }
107+
107108 fn codegen_backend ( & self ) -> & Lrc < dyn CodegenBackend > {
108109 self . compiler . codegen_backend ( )
109110 }
@@ -238,7 +239,6 @@ impl<'tcx> Queries<'tcx> {
238239 pub fn linker ( & ' tcx self , ongoing_codegen : Box < dyn Any > ) -> Result < Linker > {
239240 self . global_ctxt ( ) ?. enter ( |tcx| {
240241 Ok ( Linker {
241- sess : self . session ( ) . clone ( ) ,
242242 codegen_backend : self . codegen_backend ( ) . clone ( ) ,
243243 dep_graph : tcx. dep_graph . clone ( ) ,
244244 prepare_outputs : tcx. output_filenames ( ( ) ) . clone ( ) ,
@@ -255,7 +255,6 @@ impl<'tcx> Queries<'tcx> {
255255
256256pub struct Linker {
257257 // compilation inputs
258- sess : Lrc < Session > ,
259258 codegen_backend : Lrc < dyn CodegenBackend > ,
260259
261260 // compilation outputs
@@ -267,30 +266,25 @@ pub struct Linker {
267266}
268267
269268impl Linker {
270- pub fn link ( self ) -> Result < ( ) > {
271- let ( codegen_results, work_products) = self . codegen_backend . join_codegen (
272- self . ongoing_codegen ,
273- & self . sess ,
274- & self . prepare_outputs ,
275- ) ?;
269+ pub fn link ( self , sess : & Session ) -> Result < ( ) > {
270+ let ( codegen_results, work_products) =
271+ self . codegen_backend . join_codegen ( self . ongoing_codegen , sess, & self . prepare_outputs ) ?;
276272
277- self . sess . compile_status ( ) ?;
273+ sess. compile_status ( ) ?;
278274
279- let sess = & self . sess ;
280275 let dep_graph = self . dep_graph ;
281276 sess. time ( "serialize_work_products" , || {
282277 rustc_incremental:: save_work_product_index ( sess, & dep_graph, work_products)
283278 } ) ;
284279
285- let prof = self . sess . prof . clone ( ) ;
280+ let prof = sess. prof . clone ( ) ;
286281 prof. generic_activity ( "drop_dep_graph" ) . run ( move || drop ( dep_graph) ) ;
287282
288283 // Now that we won't touch anything in the incremental compilation directory
289284 // any more, we can finalize it (which involves renaming it)
290- rustc_incremental:: finalize_session_directory ( & self . sess , self . crate_hash ) ;
285+ rustc_incremental:: finalize_session_directory ( sess, self . crate_hash ) ;
291286
292- if !self
293- . sess
287+ if !sess
294288 . opts
295289 . output_types
296290 . keys ( )
@@ -307,7 +301,7 @@ impl Linker {
307301 }
308302
309303 let _timer = sess. prof . verbose_generic_activity ( "link_crate" ) ;
310- self . codegen_backend . link ( & self . sess , codegen_results, & self . prepare_outputs )
304+ self . codegen_backend . link ( sess, codegen_results, & self . prepare_outputs )
311305 }
312306}
313307
0 commit comments