[DONT MERGE] fix(libstd): switch to -Zpublic-dependency cargo flag#121710
[DONT MERGE] fix(libstd): switch to -Zpublic-dependency cargo flag#121710weihanglo wants to merge 2 commits intorust-lang:masterfrom
-Zpublic-dependency cargo flag#121710Conversation
|
rustbot has assigned @Mark-Simulacrum. Use r? to explicitly pick a reviewer |
|
Need to wait for rust-lang/cargo#13340 getting into beta, and then we can merge this. |
This comment has been minimized.
This comment has been minimized.
|
Got these warnings. There might be more placing needing to change. |
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.
5f387bc to
076ecff
Compare
|
Okay. Everything relies on std so every crate is streaming when I have checked with diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 7f93fdc72ef..8e0d2a0820e 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -1799,6 +1799,9 @@ fn cargo(
// Enable usage of unstable features
cargo.env("RUSTC_BOOTSTRAP", "1");
+ // In addition, we enable Cargo's `-Zpublic-dependency` so that every
+ // build runs `exported-private-dependencies` and suppress unstable warnings.
+ cargo.arg("-Zpublic-dependency");
if self.config.dump_bootstrap_shims {
prepare_behaviour_dump_dir(self.build);They every crate then screams like this: error: trait `core::alloc::Allocator` from private dependency 'core' in public interface
--> library/alloc/src/vec/mod.rs:2691:1
|
2691 | pub fn from_elem_in<T: Clone, A: Allocator>(elem: T, n: usize, alloc: A) -> Vec<T, A> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^I cannot even compile stuff unless turning the lint off... (I dunno how in x.py though) In Cargo we cap-lints dependencies, so those diagnostics wouldn't flood in to users' terminals. However, I wonder the potential performance hit it might cause if public-dependency becomes the default in edition 2024. |
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Close as we plan to keep both ways for enabling the public-dependency feature. |
rust-lang/cargo#13340 switches the feature gate for public-dependency from
cargo-featuresin Cargo.toml to CLI flag-Zpublic-dependency.cargo-featureswill continue working for 1 to 2 release cycles as a transition period, to make sure that it doesn't break self-rebuilds.