Skip to content

Commit d2e694d

Browse files
committed
Statements and block expressions take attributes too
1 parent 56b9cb2 commit d2e694d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/attributes.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
>    | _MetaItem_
2222
>    | _MetaItem_ `,` _MetaSeq_
2323
24-
Any [item declaration] or [generic lifetime or type parameter][generics] may
25-
have an attribute applied to it. Attributes are modeled on Attributes in
26-
[ECMA-335], with the syntax coming from [ECMA-334]\ (C#). An _attribute_ is a
27-
general, free-form metadatum that is interpreted according to name, convention,
28-
and language and compiler version. Attributes may appear as any of:
24+
Any [item declaration], [statement], [block expression] or
25+
[generic lifetime or type parameter][generics] may have an attribute applied to
26+
it. Attributes are modeled on Attributes in [ECMA-335], with the syntax coming
27+
from [ECMA-334]\ (C#). An _attribute_ is a general, free-form metadatum that is
28+
interpreted according to name, convention, and language and compiler version.
29+
Attributes may appear as any of:
2930

3031
* A single identifier, the attribute name
3132
* An identifier followed by the equals sign '=' and a literal, providing a
@@ -35,9 +36,9 @@ and language and compiler version. Attributes may appear as any of:
3536
* An identifier followed by a parenthesized list of sub-attribute arguments
3637

3738
_Inner attributes_, written with a bang ("!") after the hash ("#"), apply to the
38-
item that the attribute is declared within. _Outer attributes_, written without
39-
the bang after the hash, apply to the item or generic parameter that follow the
40-
attribute.
39+
item or block expression that the attribute is declared within. _Outer
40+
attributes_, written without the bang after the hash, apply to the thing that
41+
follows the attribute.
4142

4243
An example of attributes:
4344

@@ -542,4 +543,6 @@ You can implement `derive` for your own type through [procedural macros].
542543
[ECMA 334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm
543544
[ECMA 335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm
544545
[item declaration]: items.html
545-
[generics]: generics.html
546+
[generics]: generics.html
547+
[statement]: statements.html
548+
[block expression]: expressions/block-expr.html

0 commit comments

Comments
 (0)