Skip to content

Commit c6e626b

Browse files
committed
Add -Z binary-dep-depinfo
1 parent 51a8206 commit c6e626b

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ fn rustc<'a, 'cfg>(
214214
let dep_info_loc = fingerprint::dep_info_loc(cx, unit);
215215

216216
rustc.args(cx.bcx.rustflags_args(unit));
217+
if cx.bcx.config.cli_unstable().binary_dep_depinfo {
218+
rustc.arg("-Zbinary-dep-depinfo");
219+
}
217220
let mut output_options = OutputOptions::new(cx, unit);
218221
let package_id = unit.pkg.package_id();
219222
let target = unit.target.clone();

src/cargo/core/features.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ pub struct CliUnstable {
333333
pub mtime_on_use: bool,
334334
pub install_upgrade: bool,
335335
pub cache_messages: bool,
336+
pub binary_dep_depinfo: bool,
336337
}
337338

338339
impl CliUnstable {
@@ -378,6 +379,7 @@ impl CliUnstable {
378379
"mtime-on-use" => self.mtime_on_use = true,
379380
"install-upgrade" => self.install_upgrade = true,
380381
"cache-messages" => self.cache_messages = true,
382+
"binary-dep-depinfo" => self.binary_dep_depinfo = true,
381383
_ => failure::bail!("unknown `-Z` flag specified: {}", k),
382384
}
383385

tests/testsuite/dep_info.rs

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use crate::support::paths::{self, CargoPathExt};
22
use crate::support::registry::Package;
3-
use crate::support::{basic_bin_manifest, basic_manifest, main_file, project, rustc_host, Project};
3+
use crate::support::{
4+
basic_bin_manifest, basic_manifest, is_nightly, main_file, project, rustc_host, Project,
5+
};
46
use filetime::FileTime;
57
use std::fs;
68
use std::path::Path;
@@ -166,10 +168,12 @@ fn no_rewrite_if_no_change() {
166168
}
167169

168170
#[cargo_test]
169-
// Remove once https://github.com/rust-lang/rust/pull/61727 lands, and switch
170-
// to a `nightly` check.
171-
#[ignore]
172171
fn relative_depinfo_paths_ws() {
172+
if !is_nightly() {
173+
// See https://github.com/rust-lang/rust/issues/63012
174+
return;
175+
}
176+
173177
// Test relative dep-info paths in a workspace with --target with
174178
// proc-macros and other dependency kinds.
175179
Package::new("regdep", "0.1.0")
@@ -257,8 +261,9 @@ fn relative_depinfo_paths_ws() {
257261
.build();
258262

259263
let host = rustc_host();
260-
p.cargo("build --target")
264+
p.cargo("build -Z binary-dep-depinfo --target")
261265
.arg(&host)
266+
.masquerade_as_nightly_cargo()
262267
.with_stderr_contains("[COMPILING] foo [..]")
263268
.run();
264269

@@ -293,17 +298,20 @@ fn relative_depinfo_paths_ws() {
293298
);
294299

295300
// Make sure it stays fresh.
296-
p.cargo("build --target")
301+
p.cargo("build -Z binary-dep-depinfo --target")
297302
.arg(&host)
303+
.masquerade_as_nightly_cargo()
298304
.with_stderr("[FINISHED] dev [..]")
299305
.run();
300306
}
301307

302308
#[cargo_test]
303-
// Remove once https://github.com/rust-lang/rust/pull/61727 lands, and switch
304-
// to a `nightly` check.
305-
#[ignore]
306309
fn relative_depinfo_paths_no_ws() {
310+
if !is_nightly() {
311+
// See https://github.com/rust-lang/rust/issues/63012
312+
return;
313+
}
314+
307315
// Test relative dep-info paths without a workspace with proc-macros and
308316
// other dependency kinds.
309317
Package::new("regdep", "0.1.0")
@@ -382,7 +390,8 @@ fn relative_depinfo_paths_no_ws() {
382390
.file("bar/src/lib.rs", "pub fn f() {}")
383391
.build();
384392

385-
p.cargo("build")
393+
p.cargo("build -Z binary-dep-depinfo")
394+
.masquerade_as_nightly_cargo()
386395
.with_stderr_contains("[COMPILING] foo [..]")
387396
.run();
388397

@@ -417,7 +426,10 @@ fn relative_depinfo_paths_no_ws() {
417426
);
418427

419428
// Make sure it stays fresh.
420-
p.cargo("build").with_stderr("[FINISHED] dev [..]").run();
429+
p.cargo("build -Z binary-dep-depinfo")
430+
.masquerade_as_nightly_cargo()
431+
.with_stderr("[FINISHED] dev [..]")
432+
.run();
421433
}
422434

423435
#[cargo_test]
@@ -461,10 +473,11 @@ fn reg_dep_source_not_tracked() {
461473
}
462474

463475
#[cargo_test]
464-
// Remove once https://github.com/rust-lang/rust/pull/61727 lands, and switch
465-
// to a `nightly` check.
466-
#[ignore]
467476
fn canonical_path() {
477+
if !is_nightly() {
478+
// See https://github.com/rust-lang/rust/issues/63012
479+
return;
480+
}
468481
if !crate::support::symlink_supported() {
469482
return;
470483
}
@@ -491,7 +504,9 @@ fn canonical_path() {
491504
real.mkdir_p();
492505
p.symlink(real, "target");
493506

494-
p.cargo("build").run();
507+
p.cargo("build -Z binary-dep-depinfo")
508+
.masquerade_as_nightly_cargo()
509+
.run();
495510

496511
assert_deps_contains(
497512
&p,

0 commit comments

Comments
 (0)