about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-05-01 10:05:44 -0700
committerMichael Howell <michael@notriddle.com>2023-05-25 08:13:23 -0700
commit64025bb168f3ae37428387ca37ba89eb80be6544 (patch)
treef7a893a42b5bc4f1283db549ff7107980a583e1c
parentd300bffa4f0036e9138ef752610d08fc63f87a77 (diff)
downloadrust-64025bb168f3ae37428387ca37ba89eb80be6544.tar.gz
rust-64025bb168f3ae37428387ca37ba89eb80be6544.zip
bootstrap: enable Cargo `public-dependency` feature for `libstd`
-rw-r--r--library/std/Cargo.toml10
-rw-r--r--library/std/tests/common/mod.rs2
-rw-r--r--src/bootstrap/metadata.rs1
-rw-r--r--src/tools/tidy/src/main.rs4
4 files changed, 13 insertions, 4 deletions
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index 824abc72a22..4765bb5d25a 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -1,3 +1,5 @@
+cargo-features = ["public-dependency"]
+
 [package]
 name = "std"
 version = "0.0.0"
@@ -10,12 +12,12 @@ edition = "2021"
 crate-type = ["dylib", "rlib"]
 
 [dependencies]
-alloc = { path = "../alloc" }
+alloc = { path = "../alloc", public = true }
 cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
 panic_unwind = { path = "../panic_unwind", optional = true }
 panic_abort = { path = "../panic_abort" }
-core = { path = "../core" }
-libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] }
+core = { path = "../core", public = true }
+libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'], public = true }
 compiler_builtins = { version = "0.1.92" }
 profiler_builtins = { path = "../profiler_builtins", optional = true }
 unwind = { path = "../unwind" }
@@ -25,7 +27,7 @@ std_detect = { path = "../stdarch/crates/std_detect", default-features = false,
 # Dependencies of the `backtrace` crate
 addr2line = { version = "0.19.0", optional = true, default-features = false }
 rustc-demangle = { version = "0.1.21", features = ['rustc-dep-of-std'] }
-miniz_oxide = { version = "0.6.0", optional = true, default-features = false }
+miniz_oxide = { version = "0.6.0", optional = true, default-features = false, public = false }
 [dependencies.object]
 version = "0.30.0"
 optional = true
diff --git a/library/std/tests/common/mod.rs b/library/std/tests/common/mod.rs
index fce220223a0..37336e1c08f 100644
--- a/library/std/tests/common/mod.rs
+++ b/library/std/tests/common/mod.rs
@@ -1,5 +1,7 @@
 #![allow(unused)]
 
+#![allow(exported_private_dependencies)]
+
 use std::env;
 use std::fs;
 use std::path::{Path, PathBuf};
diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs
index 8f2c3faca3a..d8671ef2639 100644
--- a/src/bootstrap/metadata.rs
+++ b/src/bootstrap/metadata.rs
@@ -74,6 +74,7 @@ fn workspace_members(build: &Build) -> impl Iterator<Item = Package> {
     let collect_metadata = |manifest_path| {
         let mut cargo = Command::new(&build.initial_cargo);
         cargo
+            .env("RUSTC_BOOTSTRAP", "1")
             .arg("metadata")
             .arg("--format-version")
             .arg("1")
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index f59406c404b..2ad0ae527ac 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -16,6 +16,10 @@ use std::sync::atomic::{AtomicBool, Ordering};
 use std::thread::{self, scope, ScopedJoinHandle};
 
 fn main() {
+    // Allow using unstable cargo features in the standard library.
+    // `setenv` might not be thread safe, so run it before using multiple threads.
+    env::set_var("RUSTC_BOOTSTRAP", "1");
+
     let root_path: PathBuf = env::args_os().nth(1).expect("need path to root of repo").into();
     let cargo: PathBuf = env::args_os().nth(2).expect("need path to cargo").into();
     let output_directory: PathBuf =