From 5f387bc54447505789b8cfd814ab5f707af43de4 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 27 Feb 2024 17:03:32 -0500 Subject: [PATCH] fix(libstd): switch to `-Zpublic-dependency` cargo flag rust-lang/cargo#13340 switches the featurte gate for public-dependency from `cargo-features` in Cargo.toml to CLI flag `-Zpublic-dependency`. `cargo-features` will continue working for 1 to 2 release cycles as a transition period, to make sure that it doesn't break self-rebuilds. --- library/std/Cargo.toml | 2 -- src/bootstrap/src/core/build_steps/clean.rs | 3 ++- src/bootstrap/src/core/build_steps/dist.rs | 1 + src/bootstrap/src/core/build_steps/test.rs | 1 + src/bootstrap/src/core/metadata.rs | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 20f4310603a05..075eac58d703d 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["public-dependency"] - [package] name = "std" version = "0.0.0" diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs index 17ca92f25a928..a702f39aeb494 100644 --- a/src/bootstrap/src/core/build_steps/clean.rs +++ b/src/bootstrap/src/core/build_steps/clean.rs @@ -72,7 +72,8 @@ macro_rules! clean_crate_tree { // Since https://github.com/rust-lang/rust/pull/111076 enables // unstable cargo feature (`public-dependency`), we need to ensure // that unstable features are enabled before reading libstd Cargo.toml. - cargo.env("RUSTC_BOOTSTRAP", "1"); + cargo.env("RUSTC_BOOTSTRAP", "1") + .arg("-Zpublic-dependency"); for krate in &*self.crates { cargo.arg("-p"); diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index fe50a787f9f05..1db61a27828e2 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1014,6 +1014,7 @@ impl Step for PlainSourceTarball { // Will read the libstd Cargo.toml // which uses the unstable `public-dependency` feature. .env("RUSTC_BOOTSTRAP", "1") + .arg("-Zpublic-dependency") .current_dir(plain_dst_src); let config = if !builder.config.dry_run() { diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index a2c6e79d5e25c..12bca04e95c6b 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2816,6 +2816,7 @@ impl Step for Distcheck { // Will read the libstd Cargo.toml // which uses the unstable `public-dependency` feature. .env("RUSTC_BOOTSTRAP", "1") + .arg("-Zpublic-dependency") .arg("generate-lockfile") .arg("--manifest-path") .arg(&toml) diff --git a/src/bootstrap/src/core/metadata.rs b/src/bootstrap/src/core/metadata.rs index 5802082326a88..5530c417060e7 100644 --- a/src/bootstrap/src/core/metadata.rs +++ b/src/bootstrap/src/core/metadata.rs @@ -77,6 +77,7 @@ fn workspace_members(build: &Build) -> impl Iterator { // Will read the libstd Cargo.toml // which uses the unstable `public-dependency` feature. .env("RUSTC_BOOTSTRAP", "1") + .arg("-Zpublic-dependency") .arg("metadata") .arg("--format-version") .arg("1")