Skip to content

Commit e2346b3

Browse files
authored
Unrolled build for rust-lang#140626
Rollup merge of rust-lang#140626 - folkertdev:naked-rustfmt-skip, r=Amanieu allow `#[rustfmt::skip]` in combination with `#[naked]` fixes rust-lang#140623 We very deliberately use an allowlist to prevent weird interactions with `#[naked]`, hopefully we've now found all of the useful combinations. cc `@Amanieu`
2 parents 1bea580 + 9aee0aa commit e2346b3

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)