@@ -115,11 +115,13 @@ As non-Rust calling conventions do not support unwinding, unwinding past the end
115115of an extern function will cause the process to abort. In LLVM, this is
116116implemented by executing an illegal instruction.
117117
118- ## Function attributes
118+ ## Attributes on functions
119119
120- Inner [ attributes] on the function's block apply to the function item as a whole.
120+ [ Outer attributes] [ attributes ] are allowed on functions. [ Inner
121+ attributes] [ attributes ] are allowed directly after the ` { ` inside its [ block] .
121122
122- For example, this function will only be available while running tests.
123+ This example shows an inner attribute on a function. The function will only be
124+ available while running tests.
123125
124126```
125127fn test_only() {
@@ -130,6 +132,11 @@ fn test_only() {
130132> Note: Except for lints, it is idiomatic to only use outer attributes on
131133> function items.
132134
135+ The attributes that have meaning on a function are [ ` cfg ` ] , [ ` deprecated ` ] ,
136+ [ ` doc ` ] , ` export_name ` , ` link_section ` , ` no_mangle ` , [ the lint check
137+ attributes] , [ ` must_use ` ] , [ the testing attributes] , and [ the optimization hint
138+ attributes] .
139+
133140[ external blocks ] : items/external-blocks.html
134141[ path ] : paths.html
135142[ block ] : expressions/block-expr.html
@@ -138,3 +145,10 @@ fn test_only() {
138145[ *function item type* ] : types.html#function-item-types
139146[ Trait ] : items/traits.html
140147[ attributes ] : attributes.html
148+ [ `cfg` ] : conditional-compilation.html
149+ [ the lint check attributes ] : attributes.html#lint-check-attributes
150+ [ the testing attributes ] : attributes.html#testing
151+ [ the optimization hint attributes ] : attributes.html#optimization-hints
152+ [ `deprecated` ] : attributes.html#deprecation
153+ [ `doc` ] : attributes.html#documentation
154+ [ `must_use` ] : attributes.html#must_use
0 commit comments