Skip to content

Commit 1e094b9

Browse files
authored
Merge pull request #1051 from ehuss/remove-inner-attr
Remove inner attributes from non-block expressions.
2 parents dd2e244 + 37ca438 commit 1e094b9

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

src/expressions/array-expr.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
> **<sup>Syntax</sup>**\
66
> _ArrayExpression_ :\
7-
> &nbsp;&nbsp; `[` [_InnerAttribute_]<sup>\*</sup> _ArrayElements_<sup>?</sup> `]`
7+
> &nbsp;&nbsp; `[` _ArrayElements_<sup>?</sup> `]`
88
>
99
> _ArrayElements_ :\
1010
> &nbsp;&nbsp; &nbsp;&nbsp; [_Expression_] ( `,` [_Expression_] )<sup>\*</sup> `,`<sup>?</sup>\
@@ -46,10 +46,6 @@ const EMPTY: Vec<i32> = Vec::new();
4646
[EMPTY; 2];
4747
```
4848

49-
### Array expression attributes
50-
51-
[Inner attributes] are allowed directly after the opening bracket of an array expression in the same expression contexts as [attributes on block expressions].
52-
5349
## Array and slice indexing expressions
5450

5551
> **<sup>Syntax</sup>**\
@@ -89,11 +85,8 @@ The array index expression can be implemented for types other than arrays and sl
8985
[`Copy`]: ../special-types-and-traits.md#copy
9086
[IndexMut]: ../../std/ops/trait.IndexMut.html
9187
[Index]: ../../std/ops/trait.Index.html
92-
[Inner attributes]: ../attributes.md
9388
[_Expression_]: ../expressions.md
94-
[_InnerAttribute_]: ../attributes.md
9589
[array]: ../types/array.md
96-
[attributes on block expressions]: block-expr.md#attributes-on-block-expressions
9790
[constant expression]: ../const_eval.md#constant-expressions
9891
[constant item]: ../items/constant-items.md
9992
[literal]: ../tokens.md#literals

src/expressions/grouped-expr.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> **<sup>Syntax</sup>**\
44
> _GroupedExpression_ :\
5-
> &nbsp;&nbsp; `(` [_InnerAttribute_]<sup>\*</sup> [_Expression_] `)`
5+
> &nbsp;&nbsp; `(` [_Expression_] `)`
66
77
A *parenthesized expression* wraps a single expression, evaluating to that expression.
88
The syntax for a parenthesized expression is a `(`, then an expression, called the *enclosed operand*, and then a `)`.
@@ -39,12 +39,5 @@ assert_eq!( a.f (), "The method f");
3939
assert_eq!((a.f)(), "The field f");
4040
```
4141

42-
## Group expression attributes
43-
44-
[Inner attributes] are allowed directly after the opening parenthesis of a group expression in the same expression contexts as [attributes on block expressions].
45-
46-
[Inner attributes]: ../attributes.md
4742
[_Expression_]: ../expressions.md
48-
[_InnerAttribute_]: ../attributes.md
49-
[attributes on block expressions]: block-expr.md#attributes-on-block-expressions
5043
[place]: ../expressions.md#place-expressions-and-value-expressions

src/expressions/struct-expr.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
> &nbsp;&nbsp; | _StructExprUnit_
88
>
99
> _StructExprStruct_ :\
10-
> &nbsp;&nbsp; [_PathInExpression_] `{` [_InnerAttribute_]<sup>\*</sup> (_StructExprFields_ | _StructBase_)<sup>?</sup> `}`
10+
> &nbsp;&nbsp; [_PathInExpression_] `{` (_StructExprFields_ | _StructBase_)<sup>?</sup> `}`
1111
>
1212
> _StructExprFields_ :\
1313
> &nbsp;&nbsp; _StructExprField_ (`,` _StructExprField_)<sup>\*</sup> (`,` _StructBase_ | `,`<sup>?</sup>)
@@ -21,7 +21,6 @@
2121
>
2222
> _StructExprTuple_ :\
2323
> &nbsp;&nbsp; [_PathInExpression_] `(`\
24-
> &nbsp;&nbsp; &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
2524
> &nbsp;&nbsp; &nbsp;&nbsp; ( [_Expression_] (`,` [_Expression_])<sup>\*</sup> `,`<sup>?</sup> )<sup>?</sup>\
2625
> &nbsp;&nbsp; `)`
2726
>
@@ -122,17 +121,10 @@ let a = Gamma; // Gamma unit value.
122121
let b = Gamma{}; // Exact same value as `a`.
123122
```
124123

125-
## Struct expression attributes
126-
127-
[Inner attributes] are allowed directly after the opening brace or parenthesis of a struct expression in the same expression contexts as [attributes on block expressions].
128-
129124
[IDENTIFIER]: ../identifiers.md
130-
[Inner attributes]: ../attributes.md
131125
[TUPLE_INDEX]: ../tokens.md#tuple-index
132126
[_Expression_]: ../expressions.md
133-
[_InnerAttribute_]: ../attributes.md
134127
[_PathInExpression_]: ../paths.md#paths-in-expressions
135-
[attributes on block expressions]: block-expr.md#attributes-on-block-expressions
136128
[call expression]: call-expr.md
137129
[enum variant]: ../items/enumerations.md
138130
[if let]: if-expr.md#if-let-expressions

src/expressions/tuple-expr.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
> **<sup>Syntax</sup>**\
66
> _TupleExpression_ :\
7-
> &nbsp;&nbsp; `(` [_InnerAttribute_]<sup>\*</sup> _TupleElements_<sup>?</sup> `)`
7+
> &nbsp;&nbsp; `(` _TupleElements_<sup>?</sup> `)`
88
>
99
> _TupleElements_ :\
1010
> &nbsp;&nbsp; ( [_Expression_] `,` )<sup>+</sup> [_Expression_]<sup>?</sup>
@@ -29,10 +29,6 @@ Examples of tuple expressions and their types:
2929
| `("x".to_string(), )` | `(String, )` |
3030
| `("a", 4usize, true)`| `(&'static str, usize, bool)` |
3131

32-
### Tuple expression attributes
33-
34-
[Inner attributes] are allowed directly after the opening parenthesis of a tuple expression in the same expression contexts as [attributes on block expressions].
35-
3632
## Tuple indexing expressions
3733

3834
> **<sup>Syntax</sup>**\
@@ -70,13 +66,10 @@ assert_eq!(point.1, 0.0);
7066
> **Note**: Although arrays and slices also have elements, you must use an [array or slice indexing expression] or a [slice pattern] to access their elements.
7167
7268
[_Expression_]: ../expressions.md
73-
[_InnerAttribute_]: ../attributes.md
7469
[array or slice indexing expression]: array-expr.md#array-and-slice-indexing-expressions
75-
[attributes on block expressions]: block-expr.md#attributes-on-block-expressions
7670
[call expression]: ./call-expr.md
7771
[decimal literal]: ../tokens.md#integer-literals
7872
[field access expressions]: ./field-expr.html#field-access-expressions
79-
[inner attributes]: ../attributes.md
8073
[operands]: ../expressions.md
8174
[parenthetical expression]: grouped-expr.md
8275
[place expression]: ../expressions.md#place-expressions-and-value-expressions

0 commit comments

Comments
 (0)