From 6203cda583f31f86c6a1aa512b39e72e9a87a937 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 6 Jul 2023 16:26:37 +0300 Subject: [PATCH 1/3] reduce deps for windows-msvc targets for backtrace --- library/std/Cargo.toml | 12 +++++------- library/std/src/lib.rs | 8 +++++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index c47f910dadf..18f99c6b0e4 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -25,14 +25,12 @@ hashbrown = { version = "0.14", default-features = false, features = ['rustc-dep std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = ['rustc-dep-of-std'] } # Dependencies of the `backtrace` crate -addr2line = { version = "0.20.0", optional = true, default-features = false } rustc-demangle = { version = "0.1.21", features = ['rustc-dep-of-std'] } -miniz_oxide = { version = "0.7.0", optional = true, default-features = false, public = false } -[dependencies.object] -version = "0.31.1" -optional = true -default-features = false -features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive'] + +[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies] +miniz_oxide = { version = "0.7.0", optional = true, default-features = false } +addr2line = { version = "0.20.0", optional = true, default-features = false } +object = { version = "0.31.1", default-features = false, optional = true, features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive'] } [dev-dependencies] rand = { version = "0.8.5", default-features = false, features = ["alloc"] } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 4cd251d0ac2..6940c2d704a 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -393,9 +393,15 @@ extern crate libc; #[allow(unused_extern_crates)] extern crate unwind; +// FIXME: #94122 this extern crate definition only exist here to stop +// miniz_oxide docs leaking into std docs. Find better way to do it. +// Remove exclusion from tidy platform check when this removed. #[doc(masked)] #[allow(unused_extern_crates)] -#[cfg(feature = "miniz_oxide")] +#[cfg(all( + not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))), + feature = "miniz_oxide" +))] extern crate miniz_oxide; // During testing, this crate is not actually the "real" std library, but rather From d346a7abf40a4bfb74c34774ba649db78311aaa9 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 7 Jul 2023 15:58:09 +0300 Subject: [PATCH 2/3] remove addr2line from tidy list. Why? --- src/tools/tidy/src/deps.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 57cbfe68be4..774946da8c2 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -113,7 +113,6 @@ const PERMITTED_DEPS_LOCATION: &str = concat!(file!(), ":", line!()); /// rustc. Please check with the compiler team before adding an entry. const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ // tidy-alphabetical-start - "addr2line", "adler", "ahash", "aho-corasick", From 82383615878834d00e03941fcbd6d67ea178e4ac Mon Sep 17 00:00:00 2001 From: klensy Date: Sat, 8 Jul 2023 14:17:00 +0300 Subject: [PATCH 3/3] tidy: add exclusion for platform dependent cfg for miniz_oxide, as it hack itself --- src/tools/tidy/src/pal.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index b386b000bef..3a4d9c53d7b 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -52,6 +52,7 @@ const EXCEPTION_PATHS: &[&str] = &[ // FIXME: platform-specific code should be moved to `sys` "library/std/src/io/copy.rs", "library/std/src/io/stdio.rs", + "library/std/src/lib.rs", // for miniz_oxide leaking docs, which itself workaround "library/std/src/path.rs", "library/std/src/sys_common", // Should only contain abstractions over platforms "library/std/src/net/test.rs", // Utility helpers for tests