about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-04-17 12:27:35 +0200
committerTrevor Gross <t.gross35@gmail.com>2025-04-17 13:56:58 -0500
commitec74a38b250387fb67acbb1cecca4f4c81b966cb (patch)
tree047c9215fe35b3fa3ec1a2c7482495a0412d65b5
parent92725845336bf8dc4ceb1c2e5f04a6839b6dc5f5 (diff)
downloadrust-ec74a38b250387fb67acbb1cecca4f4c81b966cb.tar.gz
rust-ec74a38b250387fb67acbb1cecca4f4c81b966cb.zip
use `#[cfg(bootstrap)]` for rustc sync
-rw-r--r--library/compiler-builtins/compiler-builtins/Cargo.toml3
-rw-r--r--library/compiler-builtins/compiler-builtins/src/macros.rs11
2 files changed, 14 insertions, 0 deletions
diff --git a/library/compiler-builtins/compiler-builtins/Cargo.toml b/library/compiler-builtins/compiler-builtins/Cargo.toml
index bd17885a109..f5bbf4cd4d5 100644
--- a/library/compiler-builtins/compiler-builtins/Cargo.toml
+++ b/library/compiler-builtins/compiler-builtins/Cargo.toml
@@ -70,3 +70,6 @@ rustc-dep-of-std = ['compiler-builtins', 'core']
 # This makes certain traits and function specializations public that
 # are not normally public but are required by the `testcrate`
 public-test-deps = []
+
+[lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bootstrap)'] }
diff --git a/library/compiler-builtins/compiler-builtins/src/macros.rs b/library/compiler-builtins/compiler-builtins/src/macros.rs
index 13c8ecee32d..b83414ce2b7 100644
--- a/library/compiler-builtins/compiler-builtins/src/macros.rs
+++ b/library/compiler-builtins/compiler-builtins/src/macros.rs
@@ -433,6 +433,17 @@ macro_rules! intrinsics {
     ) => (
         // `#[naked]` definitions are referenced by other places, so we can't use `cfg` like the others
         pub mod $name {
+            // FIXME: when bootstrap supports `#[unsafe(naked)]` this duplication can be removed
+            #[cfg(bootstrap)]
+            #[naked]
+            $(#[$($attr)*])*
+            #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+            #[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
+            pub unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
+                $($body)*
+            }
+
+            #[cfg(not(bootstrap))]
             #[unsafe(naked)]
             $(#[$($attr)*])*
             #[cfg_attr(not(feature = "mangled-names"), no_mangle)]