about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-16 07:12:42 +0200
committerGitHub <noreply@github.com>2022-04-16 07:12:42 +0200
commitd14bda48d5bdbc03a31314584bdbab0d9918cddc (patch)
tree6102907f3bdfb8ecd5f9f42c371c6643145c9083 /compiler/rustc_interface/src
parent27490eb4232ceebc4f5e1e11b529b55994cf0333 (diff)
parent147e5da9e34b86cd213900748a9da12bceb33de2 (diff)
downloadrust-d14bda48d5bdbc03a31314584bdbab0d9918cddc.tar.gz
rust-d14bda48d5bdbc03a31314584bdbab0d9918cddc.zip
Rollup merge of #93969 - bjorn3:codegen_backend_dep_info, r=pnkfelix
Only add codegen backend to dep info if -Zbinary-dep-depinfo is used

I am currently migrating the cg_clif build system from using a binary linked to the codegen backend as rustc replacement to passing `-Zcodegen-backend` instead. Without this PR this would force cargo to rebuild the sysroot on any change to the codegen backend even if I explicitly specify that I want it to be preserved, which would make development of cg_clif a lot slower. If you still want to have changes to the codegen backend invalidate the cargo build cache you can explicitly specify `-Zbinary-dep-depinfo`.

cc ``@eddyb`` as the codegen backend was initially added to the depinfo for rust-gpu.
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 2a01b677e33..08987dff660 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -629,11 +629,15 @@ fn write_out_deps(
         });
         files.extend(extra_tracked_files);
 
-        if let Some(ref backend) = sess.opts.debugging_opts.codegen_backend {
-            files.push(backend.to_string());
-        }
-
         if sess.binary_dep_depinfo() {
+            if let Some(ref backend) = sess.opts.debugging_opts.codegen_backend {
+                if backend.contains('.') {
+                    // If the backend name contain a `.`, it is the path to an external dynamic
+                    // library. If not, it is not a path.
+                    files.push(backend.to_string());
+                }
+            }
+
             boxed_resolver.borrow_mut().access(|resolver| {
                 for cnum in resolver.cstore().crates_untracked() {
                     let source = resolver.cstore().crate_source_untracked(cnum);