Skip to content

Commit 1c19e28

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

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
@@ -161,15 +161,15 @@ Duplicate instances of the `naked` attribute have no effect.
161161
> [!NOTE]
162162
> `rustc` currently warns on subsequent duplicate `naked` attributes.
163163
164+
r[attributes.codegen.naked.unsafe]
165+
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).
166+
164167
r[attributes.codegen.naked.body]
165168
The [function body] must consist of exactly one [`naked_asm!`] macro invocation.
166169
167170
r[attributes.codegen.naked.prologue-epilogue]
168171
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.
169172
170-
r[attributes.codegen.naked.unsafe-attribute]
171-
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).
172-
173173
r[attributes.codegen.naked.call-stack]
174174
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.
175175

0 commit comments

Comments
 (0)