Skip to content

Commit c12870d

Browse files
authored
Unrolled build for rust-lang#125296
Rollup merge of rust-lang#125296 - tesuji:checkcfg-buildstd, r=Nilstrieb,michaelwoerister Fix `unexpected_cfgs` lint on std closes rust-lang#125291 r? rust-lang/compiler
2 parents 22f5bdc + 30e0ab8 commit c12870d

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

library/alloc/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,15 @@ compiler-builtins-weak-intrinsics = ["compiler_builtins/weak-intrinsics"]
4040
panic_immediate_abort = ["core/panic_immediate_abort"]
4141
# Choose algorithms that are optimized for binary size instead of runtime performance
4242
optimize_for_size = ["core/optimize_for_size"]
43+
44+
[lints.rust.unexpected_cfgs]
45+
level = "warn"
46+
# x.py uses beta cargo, so `check-cfg` entries do not yet take effect
47+
# for rust-lang/rust. But for users of `-Zbuild-std` it does.
48+
# The unused warning is waiting for rust-lang/cargo#13925 to reach beta.
49+
check-cfg = [
50+
'cfg(bootstrap)',
51+
'cfg(no_global_oom_handling)',
52+
'cfg(no_rc)',
53+
'cfg(no_sync)',
54+
]

library/core/Cargo.toml

+13
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ optimize_for_size = []
3636
# Make `RefCell` store additional debugging information, which is printed out when
3737
# a borrow error occurs
3838
debug_refcell = []
39+
40+
[lints.rust.unexpected_cfgs]
41+
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.
44+
# The unused warning is waiting for rust-lang/cargo#13925 to reach beta.
45+
check-cfg = [
46+
'cfg(bootstrap)',
47+
'cfg(no_fp_fmt_parse)',
48+
'cfg(stdarch_intel_sde)',
49+
# This matches `EXTRA_CHECK_CFGS` in `src/bootstrap/src/lib.rs`.
50+
'cfg(feature, values(any()))',
51+
]

library/std/Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,13 @@ heap_size = 0x8000000
9797
name = "stdbenches"
9898
path = "benches/lib.rs"
9999
test = true
100+
101+
[lints.rust.unexpected_cfgs]
102+
level = "warn"
103+
check-cfg = [
104+
'cfg(bootstrap)',
105+
'cfg(backtrace_in_libstd)',
106+
'cfg(netbsd10)',
107+
'cfg(target_arch, values("xtensa"))',
108+
'cfg(feature, values("std", "as_crate"))',
109+
]

src/bootstrap/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +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`
8790
(Some(Mode::Std), "stdarch_intel_sde", None),
8891
(Some(Mode::Std), "no_fp_fmt_parse", None),
8992
(Some(Mode::Std), "no_global_oom_handling", None),

0 commit comments

Comments
 (0)