Skip to content

Commit

Permalink
fix(libstd): switch to -Zpublic-dependency cargo flag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weihanglo committed Feb 27, 2024
1 parent 1e4f9e3 commit 5f387bc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions library/std/Cargo.toml
@@ -1,5 +1,3 @@
cargo-features = ["public-dependency"]

[package]
name = "std"
version = "0.0.0"
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/build_steps/clean.rs
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/dist.rs
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/metadata.rs
Expand Up @@ -77,6 +77,7 @@ fn workspace_members(build: &Build) -> impl Iterator<Item = Package> {
// 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")
Expand Down

0 comments on commit 5f387bc

Please sign in to comment.