From 64025bb168f3ae37428387ca37ba89eb80be6544 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 1 May 2023 10:05:44 -0700 Subject: [PATCH] bootstrap: enable Cargo `public-dependency` feature for `libstd` --- library/std/Cargo.toml | 10 ++++++---- library/std/tests/common/mod.rs | 2 ++ src/bootstrap/metadata.rs | 1 + src/tools/tidy/src/main.rs | 4 ++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 824abc72a223..4765bb5d25a9 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 fce220223a05..37336e1c08ff 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 8f2c3faca3a4..d8671ef2639f 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -74,6 +74,7 @@ fn workspace_members(build: &Build) -> impl Iterator { 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 f59406c404ba..2ad0ae527ac6 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 =