about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-06-09 04:10:24 +0000
committerTrevor Gross <tmgross@umich.edu>2025-06-09 04:46:54 +0000
commitfc715449326ce5dc193bc717c854c8d35c07508e (patch)
treefffde0830f0f19205c1d5c56d3d22fcd2f74ffef
parentf131c2fa47a743e3822d28b24ba7709f60b0cbc5 (diff)
downloadrust-fc715449326ce5dc193bc717c854c8d35c07508e.tar.gz
rust-fc715449326ce5dc193bc717c854c8d35c07508e.zip
compiler-builtins: Emit `rustc-check-cfg` earlier
The `build.rs` entrypoint returns early for some targets, so emscripten
and OpenBSD were not getting check-cfg set. Emit these earlier to avoid
the `unexpected_cfgs` lint.
-rw-r--r--library/compiler-builtins/compiler-builtins/build.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/compiler-builtins/compiler-builtins/build.rs b/library/compiler-builtins/compiler-builtins/build.rs
index d37fdc5df50..7c8da02fd28 100644
--- a/library/compiler-builtins/compiler-builtins/build.rs
+++ b/library/compiler-builtins/compiler-builtins/build.rs
@@ -22,6 +22,9 @@ fn main() {
 
     println!("cargo:compiler-rt={}", cwd.join("compiler-rt").display());
 
+    println!("cargo::rustc-check-cfg=cfg(kernel_user_helpers)");
+    println!("cargo::rustc-check-cfg=cfg(feature, values(\"mem-unaligned\"))");
+
     // Emscripten's runtime includes all the builtins
     if target.os == "emscripten" {
         return;
@@ -47,7 +50,6 @@ fn main() {
     }
 
     // These targets have hardware unaligned access support.
-    println!("cargo::rustc-check-cfg=cfg(feature, values(\"mem-unaligned\"))");
     if target.arch.contains("x86_64")
         || target.arch.contains("x86")
         || target.arch.contains("aarch64")
@@ -78,7 +80,6 @@ fn main() {
     // Only emit the ARM Linux atomic emulation on pre-ARMv6 architectures. This
     // includes the old androideabi. It is deprecated but it is available as a
     // rustc target (arm-linux-androideabi).
-    println!("cargo::rustc-check-cfg=cfg(kernel_user_helpers)");
     if llvm_target[0] == "armv4t"
         || llvm_target[0] == "armv5te"
         || target.triple == "arm-linux-androideabi"