Skip to content

Commit 3df0b4f

Browse files
committed
Auto merge of rust-lang#127026 - Urgau:cleanup-bootstrap-check-cfg, r=<try>
Cleanup bootstrap check-cfg This PR cleanups many custom `check-cfg` in bootstrap that have been accumulated over the years. r? ghost try-job: x86_64-msvc try-job: x86_64-gnu-aux try-job: aarch64-apple try-job: dist-various-1 try-job: dist-various-2 try-job: test-various
2 parents 127fa22 + f026e0b commit 3df0b4f

File tree

4 files changed

+4
-39
lines changed

4 files changed

+4
-39
lines changed

library/alloc/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ optimize_for_size = ["core/optimize_for_size"]
4747

4848
[lints.rust.unexpected_cfgs]
4949
level = "warn"
50-
# x.py uses beta cargo, so `check-cfg` entries do not yet take effect
51-
# for rust-lang/rust. But for users of `-Zbuild-std` it does.
5250
check-cfg = [
5351
'cfg(bootstrap)',
5452
'cfg(no_global_oom_handling)',

library/core/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ debug_refcell = []
3939

4040
[lints.rust.unexpected_cfgs]
4141
level = "warn"
42-
# x.py uses beta cargo, so `check-cfg` entries do not yet take effect
43-
# for rust-lang/rust. But for users of `-Zbuild-std` it does.
4442
check-cfg = [
4543
'cfg(bootstrap)',
4644
'cfg(no_fp_fmt_parse)',

library/std/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ test = true
100100

101101
[lints.rust.unexpected_cfgs]
102102
level = "warn"
103-
# x.py uses beta cargo, so `check-cfg` entries do not yet take effect
104-
# for rust-lang/rust. But for users of `-Zbuild-std` it does.
105103
check-cfg = [
106104
'cfg(bootstrap)',
107105
'cfg(target_arch, values("xtensa"))',

src/bootstrap/src/lib.rs

+4-33
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const LLVM_TOOLS: &[&str] = &[
7474
/// LLD file names for all flavors.
7575
const LLD_FILE_NAMES: &[&str] = &["ld.lld", "ld64.lld", "lld-link", "wasm-ld"];
7676

77-
/// Extra --check-cfg to add when building
77+
/// Extra `--check-cfg` to add when building the compiler or tools
7878
/// (Mode restriction, config name, config values (if any))
7979
#[allow(clippy::type_complexity)] // It's fine for hard-coded list and type is explained above.
8080
const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
@@ -84,38 +84,9 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
8484
(Some(Mode::ToolRustc), "rust_analyzer", None),
8585
(Some(Mode::ToolStd), "rust_analyzer", None),
8686
(Some(Mode::Codegen), "parallel_compiler", None),
87-
// NOTE: consider updating `check-cfg` entries in `std/Cargo.toml` too.
88-
// cfg(bootstrap) remove these once the bootstrap compiler supports
89-
// `lints.rust.unexpected_cfgs.check-cfg`
90-
(Some(Mode::Std), "stdarch_intel_sde", None),
91-
(Some(Mode::Std), "no_fp_fmt_parse", None),
92-
(Some(Mode::Std), "no_global_oom_handling", None),
93-
(Some(Mode::Std), "no_rc", None),
94-
(Some(Mode::Std), "no_sync", None),
95-
/* Extra values not defined in the built-in targets yet, but used in std */
96-
(Some(Mode::Std), "target_env", Some(&["libnx", "p2"])),
97-
(Some(Mode::Std), "target_os", Some(&["visionos"])),
98-
(Some(Mode::Std), "target_arch", Some(&["arm64ec", "spirv", "nvptx", "xtensa"])),
99-
(Some(Mode::ToolStd), "target_os", Some(&["visionos"])),
100-
/* Extra names used by dependencies */
101-
// FIXME: Used by serde_json, but we should not be triggering on external dependencies.
102-
(Some(Mode::Rustc), "no_btreemap_remove_entry", None),
103-
(Some(Mode::ToolRustc), "no_btreemap_remove_entry", None),
104-
// FIXME: Used by crossbeam-utils, but we should not be triggering on external dependencies.
105-
(Some(Mode::Rustc), "crossbeam_loom", None),
106-
(Some(Mode::ToolRustc), "crossbeam_loom", None),
107-
// FIXME: Used by proc-macro2, but we should not be triggering on external dependencies.
108-
(Some(Mode::Rustc), "span_locations", None),
109-
(Some(Mode::ToolRustc), "span_locations", None),
110-
// FIXME: Used by rustix, but we should not be triggering on external dependencies.
111-
(Some(Mode::Rustc), "rustix_use_libc", None),
112-
(Some(Mode::ToolRustc), "rustix_use_libc", None),
113-
// FIXME: Used by filetime, but we should not be triggering on external dependencies.
114-
(Some(Mode::Rustc), "emulate_second_only_system", None),
115-
(Some(Mode::ToolRustc), "emulate_second_only_system", None),
116-
// Needed to avoid the need to copy windows.lib into the sysroot.
117-
(Some(Mode::Rustc), "windows_raw_dylib", None),
118-
(Some(Mode::ToolRustc), "windows_raw_dylib", None),
87+
// Any library specific cfgs like `target_os`, `target_arch` should be put in
88+
// priority the `[lints.rust.unexpected_cfgs.check-cfg]` table
89+
// in the appropriate `library/{std,alloc,core}/Cargo.toml`
11990
];
12091

12192
/// A structure representing a Rust compiler.

0 commit comments

Comments
 (0)