Skip to content

Commit

Permalink
Rollup merge of rust-lang#135501 - tgross35:stdlib-dependencies-priva…
Browse files Browse the repository at this point in the history
…te, r=bjorn3

Inject `compiler_builtins` during postprocessing and ensure it is made private

Follow up of rust-lang#135278

Do the following:

* Inject `compiler_builtins` during postprocessing, rather than injecting `extern crate compiler_builtins as _` into the AST
* Do not make dependencies of `std` private by default (this was added in rust-lang#135278)
* Make sure sysroot crates correctly mark their dependencies private/public
* Ensure that marking a dependency private makes its dependents private by default as well, unless otherwise specified
* Do the `compiler_builtins` update that has been blocked on this

There is more detail in the commit messages. This includes the changes I was working on in rust-lang#136226.

try-job: test-various
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: i686-mingw-1
try-job: i686-mingw-2
  • Loading branch information
matthiaskrgr authored Feb 22, 2025
2 parents a36adc4 + 4563548 commit 36a59f8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 3 additions & 1 deletion alloc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["public-dependency"]

[package]
name = "alloc"
version = "0.0.0"
Expand All @@ -9,7 +11,7 @@ autobenches = false
edition = "2021"

[dependencies]
core = { path = "../core" }
core = { path = "../core", public = true }
compiler_builtins = { version = "=0.1.146", features = ['rustc-dep-of-std'] }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion std/src/sys/pal/uefi/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ mod uefi_command_internal {
}
}

pub fn start_image(&mut self) -> io::Result<r_efi::efi::Status> {
pub(crate) fn start_image(&mut self) -> io::Result<r_efi::efi::Status> {
self.update_st_crc32()?;

// Use our system table instead of the default one
Expand Down
2 changes: 1 addition & 1 deletion std/src/sys/pal/uefi/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub(crate) mod system_time_internal {

// This algorithm is based on the one described in the post
// https://blog.reverberate.org/2020/05/12/optimizing-date-algorithms.html
pub const fn uefi_time_to_duration(t: r_efi::system::Time) -> Duration {
pub(crate) const fn uefi_time_to_duration(t: r_efi::system::Time) -> Duration {
assert!(t.month <= 12);
assert!(t.month != 0);

Expand Down
8 changes: 5 additions & 3 deletions sysroot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
cargo-features = ["public-dependency"]

[package]
name = "sysroot"
version = "0.0.0"
edition = "2021"

# this is a dummy crate to ensure that all required crates appear in the sysroot
[dependencies]
proc_macro = { path = "../proc_macro" }
proc_macro = { path = "../proc_macro", public = true }
profiler_builtins = { path = "../profiler_builtins", optional = true }
std = { path = "../std" }
test = { path = "../test" }
std = { path = "../std", public = true }
test = { path = "../test", public = true }

# Forward features to the `std` crate as necessary
[features]
Expand Down
6 changes: 4 additions & 2 deletions test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
cargo-features = ["public-dependency"]

[package]
name = "test"
version = "0.0.0"
edition = "2021"

[dependencies]
getopts = { version = "0.2.21", features = ['rustc-dep-of-std'] }
std = { path = "../std" }
core = { path = "../core" }
std = { path = "../std", public = true }
core = { path = "../core", public = true }

[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
libc = { version = "0.2.150", default-features = false }

0 comments on commit 36a59f8

Please sign in to comment.