Skip to content

Commit 169fb5f

Browse files
committed
List where attributes are accepted and which kind (outer/inner)
1 parent 57bfd18 commit 169fb5f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/attributes.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ item that the attribute is declared within. _Outer attributes_, written without
4040
the bang after the hash, apply to the item or generic parameter that follow the
4141
attribute.
4242

43-
Any [item declaration] or [generic lifetime or type parameter][generics] may
44-
have an attribute applied to it.
43+
Attributes may be applied to many things in the language:
44+
45+
* All [item declarations] accept outer attributes while [external blocks],
46+
[functions], [implementations], and [modules] accept inner attributes.
47+
* [Statements] accept outer attributes.
48+
* [Enum] variants and [struct] and [union] fields accept outer attributes.
49+
* [Match expression arms][match expressions] accept outer attributes.
50+
* [Generic lifetime or type parameter][generics] accept outer attributes.
4551

4652
An example of attributes:
4753

@@ -543,5 +549,10 @@ You can implement `derive` for your own type through [procedural macros].
543549
[zero-variant enum]: items/enumerations.html#zero-variant-enums
544550
[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm
545551
[ECMA-335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm
546-
[item declaration]: items.html
552+
[item declarations]: items.html
547553
[generics]: items/generics.html
554+
[implementations]: items/implementations.html
555+
[modules]: items/modules.html
556+
[statements]: statements.html
557+
[match expressions]: expressions/match-expr.html
558+
[external blocks]: items/external-blocks.html

0 commit comments

Comments
 (0)