use #[cfg(bootstrap)] for rustc sync

This commit is contained in:
Folkert de Vries 2025-04-17 12:27:35 +02:00 committed by Trevor Gross
parent 9272584533
commit ec74a38b25
2 changed files with 14 additions and 0 deletions

View file

@ -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)'] }

View file

@ -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)]