@@ -101,9 +101,10 @@ impl<'tcx> Queries<'tcx> {
101
101
}
102
102
}
103
103
104
- fn session ( & self ) -> & Lrc < Session > {
104
+ fn session ( & self ) -> & Session {
105
105
& self . compiler . sess
106
106
}
107
+
107
108
fn codegen_backend ( & self ) -> & Lrc < dyn CodegenBackend > {
108
109
self . compiler . codegen_backend ( )
109
110
}
@@ -238,7 +239,6 @@ impl<'tcx> Queries<'tcx> {
238
239
pub fn linker ( & ' tcx self , ongoing_codegen : Box < dyn Any > ) -> Result < Linker > {
239
240
self . global_ctxt ( ) ?. enter ( |tcx| {
240
241
Ok ( Linker {
241
- sess : self . session ( ) . clone ( ) ,
242
242
codegen_backend : self . codegen_backend ( ) . clone ( ) ,
243
243
dep_graph : tcx. dep_graph . clone ( ) ,
244
244
prepare_outputs : tcx. output_filenames ( ( ) ) . clone ( ) ,
@@ -255,7 +255,6 @@ impl<'tcx> Queries<'tcx> {
255
255
256
256
pub struct Linker {
257
257
// compilation inputs
258
- sess : Lrc < Session > ,
259
258
codegen_backend : Lrc < dyn CodegenBackend > ,
260
259
261
260
// compilation outputs
@@ -267,30 +266,25 @@ pub struct Linker {
267
266
}
268
267
269
268
impl 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 ) ?;
276
272
277
- self . sess . compile_status ( ) ?;
273
+ sess. compile_status ( ) ?;
278
274
279
- let sess = & self . sess ;
280
275
let dep_graph = self . dep_graph ;
281
276
sess. time ( "serialize_work_products" , || {
282
277
rustc_incremental:: save_work_product_index ( sess, & dep_graph, work_products)
283
278
} ) ;
284
279
285
- let prof = self . sess . prof . clone ( ) ;
280
+ let prof = sess. prof . clone ( ) ;
286
281
prof. generic_activity ( "drop_dep_graph" ) . run ( move || drop ( dep_graph) ) ;
287
282
288
283
// Now that we won't touch anything in the incremental compilation directory
289
284
// 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 ) ;
291
286
292
- if !self
293
- . sess
287
+ if !sess
294
288
. opts
295
289
. output_types
296
290
. keys ( )
@@ -307,7 +301,7 @@ impl Linker {
307
301
}
308
302
309
303
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 )
311
305
}
312
306
}
313
307
0 commit comments