@@ -23,12 +23,9 @@ StructExprField ->
23
23
24
24
StructBase -> `..` Expression
25
25
26
- StructExprTuple ->
27
- PathInExpression `(`
28
- ( Expression (`,` Expression)* `,`? )?
29
- `)`
26
+ StructExprTuple -> CallExpression
30
27
31
- StructExprUnit -> PathInExpression
28
+ StructExprUnit -> PathExpression
32
29
```
33
30
34
31
r[ expr.struct.intro]
@@ -129,6 +126,20 @@ let c = Position; // `c` is a function that takes 3 arguments.
129
126
let pos = c (8 , 6 , 7 ); // Creates a `Position` value.
130
127
```
131
128
129
+ > [ !NOTE]
130
+ > While the grammar permits qualified paths, the last segment can't be a type alias:
131
+ >
132
+ > ``` rust
133
+ > trait Tr { type T ; }
134
+ > impl <T > Tr for T { type T = T ; }
135
+ >
136
+ > struct Tuple ();
137
+ > enum Enum { Tuple () }
138
+ >
139
+ > // <Unit as Tr>::T(); // causes an error -- `::T` is a type, not a value
140
+ > <Enum as Tr >:: T :: Tuple (); // OK
141
+ > ```
142
+
132
143
r [expr . struct . unit]
133
144
## Unit struct expression
134
145
@@ -142,6 +153,20 @@ let a = Gamma; // Gamma unit value.
142
153
let b = Gamma {}; // Exact same value as `a`.
143
154
```
144
155
156
+ > [ !NOTE]
157
+ > While the grammar permits qualified paths, the last segment can't be a type alias:
158
+ >
159
+ > ``` rust
160
+ > trait Tr { type T ; }
161
+ > impl <T > Tr for T { type T = T ; }
162
+ >
163
+ > struct Unit ;
164
+ > enum Enum { Unit }
165
+ >
166
+ > // <Unit as Tr>::T; // causes an error -- `::T` is a type, not a value
167
+ > <Enum as Tr >:: T :: Unit ; // OK
168
+ > ```
169
+
145
170
[call expression ]: call - expr . md
146
171
[enum variant ]: .. / items / enumerations . md
147
172
[if let ]: if - expr . md#if - let - expressions
0 commit comments