Skip to content

Commit d749b5e

Browse files
Gate binary dependency information behind -Zbinary-dep-depinfo
1 parent eafb42d commit d749b5e

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/librustc/session/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
14681468
symbol_mangling_version: SymbolManglingVersion = (SymbolManglingVersion::Legacy,
14691469
parse_symbol_mangling_version, [TRACKED],
14701470
"which mangling version to use for symbol names"),
1471+
binary_dep_depinfo: bool = (false, parse_bool, [TRACKED],
1472+
"include artifacts (sysroot, crate dependencies) used during compilation in dep-info"),
14711473
}
14721474

14731475
pub fn default_lib_output() -> CrateType {

src/librustc/session/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,9 @@ impl Session {
545545
pub fn print_llvm_passes(&self) -> bool {
546546
self.opts.debugging_opts.print_llvm_passes
547547
}
548+
pub fn binary_dep_depinfo(&self) -> bool {
549+
self.opts.debugging_opts.binary_dep_depinfo
550+
}
548551

549552
/// Gets the features enabled for the current compilation session.
550553
/// DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents

src/librustc_interface/passes.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -677,17 +677,19 @@ fn write_out_deps(compiler: &Compiler, outputs: &OutputFilenames, out_filenames:
677677
.map(|fmap| escape_dep_filename(&fmap.name))
678678
.collect();
679679

680-
for cnum in compiler.cstore.crates_untracked() {
681-
let metadata = compiler.cstore.crate_data_as_rc_any(cnum);
682-
let metadata = metadata.downcast_ref::<cstore::CrateMetadata>().unwrap();
683-
if let Some((path, _)) = &metadata.source.dylib {
684-
files.push(escape_dep_filename(&FileName::Real(path.clone())));
685-
}
686-
if let Some((path, _)) = &metadata.source.rlib {
687-
files.push(escape_dep_filename(&FileName::Real(path.clone())));
688-
}
689-
if let Some((path, _)) = &metadata.source.rmeta {
690-
files.push(escape_dep_filename(&FileName::Real(path.clone())));
680+
if sess.binary_dep_depinfo() {
681+
for cnum in compiler.cstore.crates_untracked() {
682+
let metadata = compiler.cstore.crate_data_as_rc_any(cnum);
683+
let metadata = metadata.downcast_ref::<cstore::CrateMetadata>().unwrap();
684+
if let Some((path, _)) = &metadata.source.dylib {
685+
files.push(escape_dep_filename(&FileName::Real(path.clone())));
686+
}
687+
if let Some((path, _)) = &metadata.source.rlib {
688+
files.push(escape_dep_filename(&FileName::Real(path.clone())));
689+
}
690+
if let Some((path, _)) = &metadata.source.rmeta {
691+
files.push(escape_dep_filename(&FileName::Real(path.clone())));
692+
}
691693
}
692694
}
693695

0 commit comments

Comments
 (0)