Skip to content

Commit 87b28f2

Browse files
committed
Functions: Move attribute section back to bottom
1 parent 0ef6b4a commit 87b28f2

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/items/functions.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,6 @@ As non-Rust calling conventions do not support unwinding, unwinding past the end
137137
of an extern function will cause the process to abort. In LLVM, this is
138138
implemented by executing an illegal instruction.
139139

140-
## Attributes on functions
141-
142-
[Outer attributes][attributes] are allowed on functions. [Inner
143-
attributes][attributes] are allowed directly after the `{` inside its [block].
144-
145-
This example shows an inner attribute on a function. The function will only be
146-
available while running tests.
147-
148-
```
149-
fn test_only() {
150-
#![test]
151-
}
152-
```
153-
154-
> Note: Except for lints, it is idiomatic to only use outer attributes on
155-
> function items.
156-
157-
The attributes that have meaning on a function are [`cfg`], [`deprecated`],
158-
[`doc`], `export_name`, `link_section`, `no_mangle`, [the lint check
159-
attributes], [`must_use`], [the procedural macro attributes], [the testing
160-
attributes], and [the optimization hint
161-
attributes].
162-
163140
## Const functions
164141

165142
Functions qualified with the `const` keyword are const functions. _Const
@@ -212,6 +189,29 @@ Exhaustive list of permitted structures in const functions:
212189
only and you won't be able to call the `const unsafe fn` from within another
213190
const function even if you use `unsafe`
214191

192+
## Attributes on functions
193+
194+
[Outer attributes][attributes] are allowed on functions. [Inner
195+
attributes][attributes] are allowed directly after the `{` inside its [block].
196+
197+
This example shows an inner attribute on a function. The function will only be
198+
available while running tests.
199+
200+
```
201+
fn test_only() {
202+
#![test]
203+
}
204+
```
205+
206+
> Note: Except for lints, it is idiomatic to only use outer attributes on
207+
> function items.
208+
209+
The attributes that have meaning on a function are [`cfg`], [`deprecated`],
210+
[`doc`], `export_name`, `link_section`, `no_mangle`, [the lint check
211+
attributes], [`must_use`], [the procedural macro attributes], [the testing
212+
attributes], and [the optimization hint
213+
attributes].
214+
215215
[IDENTIFIER]: identifiers.html
216216
[RAW_STRING_LITERAL]: tokens.html#raw-string-literals
217217
[STRING_LITERAL]: tokens.html#string-literals

0 commit comments

Comments
 (0)