about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-11-17 08:34:55 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-11-17 17:30:36 +1100
commitaed8e1f3b635c379d03007b86cff4dd36cb49eb4 (patch)
tree04d8bca5822f7187f15a3c87d5e4335fde8f3ea0 /compiler/rustc_driver_impl/src
parentde91b6d24962a4662786bbf0fab71854b3976af1 (diff)
downloadrust-aed8e1f3b635c379d03007b86cff4dd36cb49eb4.tar.gz
rust-aed8e1f3b635c379d03007b86cff4dd36cb49eb4.zip
Move `CodegenBackend` out of `Linker`.
It can easily be passed in. And that removes the single clone of
`Compiler::codegen_backend`, which means it no longer needs to be `Lrc`.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 7cded5507cb..f38a8945c7f 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -361,7 +361,7 @@ fn run_compiler(
                     }
                     let should_stop = print_crate_info(
                         &handler,
-                        &**compiler.codegen_backend(),
+                        compiler.codegen_backend(),
                         compiler.session(),
                         false,
                     );
@@ -385,12 +385,11 @@ fn run_compiler(
 
     interface::run_compiler(config, |compiler| {
         let sess = compiler.session();
+        let codegen_backend = compiler.codegen_backend();
         let handler = EarlyErrorHandler::new(sess.opts.error_format);
 
-        let should_stop = print_crate_info(&handler, &**compiler.codegen_backend(), sess, true)
-            .and_then(|| {
-                list_metadata(&handler, sess, &*compiler.codegen_backend().metadata_loader())
-            })
+        let should_stop = print_crate_info(&handler, codegen_backend, sess, true)
+            .and_then(|| list_metadata(&handler, sess, &*codegen_backend.metadata_loader()))
             .and_then(|| try_process_rlink(sess, compiler));
 
         if should_stop == Compilation::Stop {
@@ -482,7 +481,7 @@ fn run_compiler(
 
         if let Some(linker) = linker {
             let _timer = sess.timer("link");
-            linker.link(sess)?
+            linker.link(sess, codegen_backend)?
         }
 
         if sess.opts.unstable_opts.print_fuel.is_some() {