allow #[rustfmt::skip] in combination with #[naked]

This commit is contained in:
Folkert de Vries
2025-05-03 19:10:43 +02:00
parent 097cd98869
commit 9aee0aa453
2 changed files with 9 additions and 1 deletions
+3 -1
View File
@@ -683,7 +683,9 @@ fn check_naked(
}
}
if !other_attr.has_any_name(ALLOW_LIST) {
if !other_attr.has_any_name(ALLOW_LIST)
&& !matches!(other_attr.path().as_slice(), [sym::rustfmt, ..])
{
let path = other_attr.path();
let path: Vec<_> = path.iter().map(|s| s.as_str()).collect();
let other_attr_name = path.join("::");
+6
View File
@@ -231,3 +231,9 @@ pub extern "C" fn compatible_linkage() {
pub extern "C" fn rustc_std_internal_symbol() {
naked_asm!("", options(raw));
}
#[rustfmt::skip]
#[unsafe(naked)]
pub extern "C" fn rustfmt_skip() {
naked_asm!("", options(raw));
}