Add -Z binary-dep-depinfo

This commit is contained in:
Eric Huss 2019-07-26 09:06:58 -07:00
parent 51a8206c38
commit c6e626b339
3 changed files with 35 additions and 15 deletions

View File

@ -214,6 +214,9 @@ fn rustc<'a, 'cfg>(
let dep_info_loc = fingerprint::dep_info_loc(cx, unit); let dep_info_loc = fingerprint::dep_info_loc(cx, unit);
rustc.args(cx.bcx.rustflags_args(unit)); rustc.args(cx.bcx.rustflags_args(unit));
if cx.bcx.config.cli_unstable().binary_dep_depinfo {
rustc.arg("-Zbinary-dep-depinfo");
}
let mut output_options = OutputOptions::new(cx, unit); let mut output_options = OutputOptions::new(cx, unit);
let package_id = unit.pkg.package_id(); let package_id = unit.pkg.package_id();
let target = unit.target.clone(); let target = unit.target.clone();

View File

@ -333,6 +333,7 @@ pub struct CliUnstable {
pub mtime_on_use: bool, pub mtime_on_use: bool,
pub install_upgrade: bool, pub install_upgrade: bool,
pub cache_messages: bool, pub cache_messages: bool,
pub binary_dep_depinfo: bool,
} }
impl CliUnstable { impl CliUnstable {
@ -378,6 +379,7 @@ impl CliUnstable {
"mtime-on-use" => self.mtime_on_use = true, "mtime-on-use" => self.mtime_on_use = true,
"install-upgrade" => self.install_upgrade = true, "install-upgrade" => self.install_upgrade = true,
"cache-messages" => self.cache_messages = true, "cache-messages" => self.cache_messages = true,
"binary-dep-depinfo" => self.binary_dep_depinfo = true,
_ => failure::bail!("unknown `-Z` flag specified: {}", k), _ => failure::bail!("unknown `-Z` flag specified: {}", k),
} }

View File

@ -1,6 +1,8 @@
use crate::support::paths::{self, CargoPathExt}; use crate::support::paths::{self, CargoPathExt};
use crate::support::registry::Package; use crate::support::registry::Package;
use crate::support::{basic_bin_manifest, basic_manifest, main_file, project, rustc_host, Project}; use crate::support::{
basic_bin_manifest, basic_manifest, is_nightly, main_file, project, rustc_host, Project,
};
use filetime::FileTime; use filetime::FileTime;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
@ -166,10 +168,12 @@ fn no_rewrite_if_no_change() {
} }
#[cargo_test] #[cargo_test]
// Remove once https://github.com/rust-lang/rust/pull/61727 lands, and switch
// to a `nightly` check.
#[ignore]
fn relative_depinfo_paths_ws() { fn relative_depinfo_paths_ws() {
if !is_nightly() {
// See https://github.com/rust-lang/rust/issues/63012
return;
}
// Test relative dep-info paths in a workspace with --target with // Test relative dep-info paths in a workspace with --target with
// proc-macros and other dependency kinds. // proc-macros and other dependency kinds.
Package::new("regdep", "0.1.0") Package::new("regdep", "0.1.0")
@ -257,8 +261,9 @@ fn relative_depinfo_paths_ws() {
.build(); .build();
let host = rustc_host(); let host = rustc_host();
p.cargo("build --target") p.cargo("build -Z binary-dep-depinfo --target")
.arg(&host) .arg(&host)
.masquerade_as_nightly_cargo()
.with_stderr_contains("[COMPILING] foo [..]") .with_stderr_contains("[COMPILING] foo [..]")
.run(); .run();
@ -293,17 +298,20 @@ fn relative_depinfo_paths_ws() {
); );
// Make sure it stays fresh. // Make sure it stays fresh.
p.cargo("build --target") p.cargo("build -Z binary-dep-depinfo --target")
.arg(&host) .arg(&host)
.masquerade_as_nightly_cargo()
.with_stderr("[FINISHED] dev [..]") .with_stderr("[FINISHED] dev [..]")
.run(); .run();
} }
#[cargo_test] #[cargo_test]
// Remove once https://github.com/rust-lang/rust/pull/61727 lands, and switch
// to a `nightly` check.
#[ignore]
fn relative_depinfo_paths_no_ws() { fn relative_depinfo_paths_no_ws() {
if !is_nightly() {
// See https://github.com/rust-lang/rust/issues/63012
return;
}
// Test relative dep-info paths without a workspace with proc-macros and // Test relative dep-info paths without a workspace with proc-macros and
// other dependency kinds. // other dependency kinds.
Package::new("regdep", "0.1.0") Package::new("regdep", "0.1.0")
@ -382,7 +390,8 @@ fn relative_depinfo_paths_no_ws() {
.file("bar/src/lib.rs", "pub fn f() {}") .file("bar/src/lib.rs", "pub fn f() {}")
.build(); .build();
p.cargo("build") p.cargo("build -Z binary-dep-depinfo")
.masquerade_as_nightly_cargo()
.with_stderr_contains("[COMPILING] foo [..]") .with_stderr_contains("[COMPILING] foo [..]")
.run(); .run();
@ -417,7 +426,10 @@ fn relative_depinfo_paths_no_ws() {
); );
// Make sure it stays fresh. // Make sure it stays fresh.
p.cargo("build").with_stderr("[FINISHED] dev [..]").run(); p.cargo("build -Z binary-dep-depinfo")
.masquerade_as_nightly_cargo()
.with_stderr("[FINISHED] dev [..]")
.run();
} }
#[cargo_test] #[cargo_test]
@ -461,10 +473,11 @@ fn reg_dep_source_not_tracked() {
} }
#[cargo_test] #[cargo_test]
// Remove once https://github.com/rust-lang/rust/pull/61727 lands, and switch
// to a `nightly` check.
#[ignore]
fn canonical_path() { fn canonical_path() {
if !is_nightly() {
// See https://github.com/rust-lang/rust/issues/63012
return;
}
if !crate::support::symlink_supported() { if !crate::support::symlink_supported() {
return; return;
} }
@ -491,7 +504,9 @@ fn canonical_path() {
real.mkdir_p(); real.mkdir_p();
p.symlink(real, "target"); p.symlink(real, "target");
p.cargo("build").run(); p.cargo("build -Z binary-dep-depinfo")
.masquerade_as_nightly_cargo()
.run();
assert_deps_contains( assert_deps_contains(
&p, &p,