Skip to content

Commit 9aee0aa

Browse files
committed
allow #[rustfmt::skip] in combination with #[naked]
1 parent 097cd98 commit 9aee0aa

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler/rustc_passes/src/check_attr.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
683683
}
684684
}
685685

686-
if !other_attr.has_any_name(ALLOW_LIST) {
686+
if !other_attr.has_any_name(ALLOW_LIST)
687+
&& !matches!(other_attr.path().as_slice(), [sym::rustfmt, ..])
688+
{
687689
let path = other_attr.path();
688690
let path: Vec<_> = path.iter().map(|s| s.as_str()).collect();
689691
let other_attr_name = path.join("::");

tests/ui/asm/naked-functions.rs

+6
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,9 @@ pub extern "C" fn compatible_linkage() {
231231
pub extern "C" fn rustc_std_internal_symbol() {
232232
naked_asm!("", options(raw));
233233
}
234+
235+
#[rustfmt::skip]
236+
#[unsafe(naked)]
237+
pub extern "C" fn rustfmt_skip() {
238+
naked_asm!("", options(raw));
239+
}

0 commit comments

Comments
 (0)