From 7e99764df351e558aff6c7077e6a942d0818c31b Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Wed, 27 Dec 2017 09:55:20 -0800 Subject: [PATCH 1/2] remove dep-info files as targets in themselves --- src/librustc_driver/driver.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 33234ffb66388..371f8ac6f283c 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1162,6 +1162,8 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, crate_name: &str) { out_filenames.push(p); } } + // Do not include the dep-info file in itself as a target + OutputType::DepInfo => { } _ => { out_filenames.push(file); } From 8c09d29d04dabc96a3ae88d914e3b54220952943 Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Mon, 15 Jan 2018 13:08:27 -0800 Subject: [PATCH 2/2] Add `-Z dep-info-omit-d-target` to control dep-info style This avoids a breaking change to dep-info output, putting the gcc/clang-compliant dep-info behavior behind a flag --- src/librustc/session/config.rs | 3 +++ src/librustc_driver/driver.rs | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 8c8108b060468..eb1a84b9dc720 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1236,6 +1236,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, overriding the default for the current target"), human_readable_cgu_names: bool = (false, parse_bool, [TRACKED], "generate human-readable, predictable names for codegen units"), + dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED], + "in dep-info output, omit targets for tracking dependencies of the dep-info files \ + themselves"), } pub fn default_lib_output() -> CrateType { diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 371f8ac6f283c..f7e35ba0081e4 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1162,8 +1162,9 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, crate_name: &str) { out_filenames.push(p); } } - // Do not include the dep-info file in itself as a target - OutputType::DepInfo => { } + OutputType::DepInfo if sess.opts.debugging_opts.dep_info_omit_d_target => { + // Don't add the dep-info output when omitting it from dep-info targets + } _ => { out_filenames.push(file); }