Skip to content

Commit f3df388

Browse files
committed
Move and reword attributes.codegen.naked.unsafe
To follow the attribute template, and to simplify the wording a little.
1 parent 5300cfc commit f3df388

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/attributes/codegen.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ Duplicate instances of the `naked` attribute have no effect.
8888
> [!NOTE]
8989
> `rustc` currently warns on subsequent duplicate `naked` attributes.
9090
91+
r[attributes.codegen.naked.unsafe]
92+
The `naked` attribute must be marked with [`unsafe`][attributes.safety] because the body must respect the function's calling convention, uphold its signature, and either return or diverge (i.e., not fall through past the end of the assembly code).
93+
9194
r[attributes.codegen.naked.body]
9295
The [function body] must consist of exactly one [`naked_asm!`] macro invocation.
9396
9497
r[attributes.codegen.naked.prologue-epilogue]
9598
No function prologue or epilogue is generated for the attributed function. The assembly code in the `naked_asm!` block constitutes the full body of a naked function.
9699
97-
r[attributes.codegen.naked.unsafe-attribute]
98-
The `naked` attribute is an [unsafe attribute]. Annotating a function with `#[unsafe(naked)]` comes with the safety obligation that the body must respect the function's calling convention, uphold its signature, and either return or diverge (i.e., not fall through past the end of the assembly code).
99-
100100
r[attributes.codegen.naked.call-stack]
101101
The assembly code may assume that the call stack and register state are valid on entry as per the signature and calling convention of the function.
102102

0 commit comments

Comments
 (0)