reference
reference copied to clipboard
Unclear block attribute positions
The Attributes on block expressions section specifies when inner attributes are allowed in blocks, it's unclear whether that applies to outer attributes too? Even more confusing is that the example showcases outer attributes instead
https://github.com/rust-lang/reference/blob/411c2f0d5cebf48453ae2d136ad0c5e611d39aec/src/expressions/block-expr.md?plain=1#L143-L164
It seems reasonable to me to add an example of an inner attribute and also a demonstration of where it is invalid (such as a closure?).
Those restrictions are for inner attributes only. Perhaps as a reminder, it could link to https://github.com/rust-lang/reference/blob/411c2f0d5cebf48453ae2d136ad0c5e611d39aec/src/expressions.md#expression-attributes to explain the limitations on outer attributes when used as an expression/statement?