Skip to content

Commit 9b1427f

Browse files
committed
Add naked attribute template rules
1 parent 2ca2191 commit 9b1427f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/attributes/codegen.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ The *`naked` [attribute]* prevents the compiler from emitting a function prologu
144144
> # }
145145
> ```
146146
147+
r[attributes.codegen.naked.syntax]
148+
The `naked` attribute uses the [MetaWord] syntax and thus does not take any inputs.
149+
150+
r[attributes.codegen.naked.allowed-positions]
151+
The `naked` attribute may only be applied to:
152+
153+
- [Free functions][items.fn]
154+
- [Inherent associated functions][items.associated.fn]
155+
- [Trait impl functions][items.impl.trait]
156+
- [Trait definition functions][items.traits] with a body
157+
158+
r[attributes.codegen.naked.duplicates]
159+
Duplicate instances of the `naked` attribute have no effect.
160+
161+
> [!NOTE]
162+
> `rustc` currently warns on subsequent duplicate `naked` attributes.
163+
147164
r[attributes.codegen.naked.body]
148165
The [function body] must consist of exactly one [`naked_asm!`] macro invocation.
149166

0 commit comments

Comments
 (0)