Skip to content

Commit 657a0a3

Browse files
committed
Remove enum variant expression page
It is quite redundant with the (IMO badly named) struct expression.
1 parent eb52903 commit 657a0a3

File tree

6 files changed

+10
-61
lines changed

6 files changed

+10
-61
lines changed

src/SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
- [Array and index expressions](expressions/array-expr.md)
5757
- [Tuple and index expressions](expressions/tuple-expr.md)
5858
- [Struct expressions](expressions/struct-expr.md)
59-
- [Enum variant expressions](expressions/enum-variant-expr.md)
6059
- [Call expressions](expressions/call-expr.md)
6160
- [Method call expressions](expressions/method-call-expr.md)
6261
- [Field access expressions](expressions/field-expr.md)

src/expressions.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
>       | [_TupleExpression_]\
1919
>       | [_TupleIndexingExpression_]\
2020
>       | [_StructExpression_]\
21-
>       | [_EnumerationVariantExpression_]\
2221
>       | [_CallExpression_]\
2322
>       | [_MethodCallExpression_]\
2423
>       | [_FieldExpression_]\
@@ -103,7 +102,6 @@ evaluate them conditionally as described on their respective pages.
103102
* Tuple expression
104103
* Tuple index expression
105104
* Struct expression
106-
* Enumeration variant expression
107105
* Call expression
108106
* Method call expression
109107
* Field expression
@@ -259,7 +257,7 @@ a few specific cases:
259257

260258
* Before an expression used as a [statement].
261259
* Elements of [array expressions], [tuple expressions], [call expressions],
262-
and tuple-style [struct] and [enum variant] expressions.
260+
and tuple-style [struct] expressions.
263261
<!--
264262
These were likely stabilized inadvertently.
265263
See https://github.com/rust-lang/rust/issues/32796 and
@@ -277,7 +275,6 @@ They are never allowed before:
277275

278276
[block expressions]: expressions/block-expr.md
279277
[call expressions]: expressions/call-expr.md
280-
[enum variant]: expressions/enum-variant-expr.md
281278
[field]: expressions/field-expr.md
282279
[functional update]: expressions/struct-expr.md#functional-update-syntax
283280
[`if let`]: expressions/if-expr.md#if-let-expressions
@@ -329,7 +326,6 @@ They are never allowed before:
329326
[_ComparisonExpression_]: expressions/operator-expr.md#comparison-operators
330327
[_CompoundAssignmentExpression_]: expressions/operator-expr.md#compound-assignment-expressions
331328
[_ContinueExpression_]: expressions/loop-expr.md#continue-expressions
332-
[_EnumerationVariantExpression_]: expressions/enum-variant-expr.md
333329
[_FieldExpression_]: expressions/field-expr.md
334330
[_GroupedExpression_]: expressions/grouped-expr.md
335331
[_IfExpression_]: expressions/if-expr.md#if-expressions

src/expressions/enum-variant-expr.md

-47
This file was deleted.

src/expressions/struct-expr.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
>
2828
> _StructExprUnit_ : [_PathInExpression_]
2929
30-
A _struct expression_ creates a struct or union value.
31-
It consists of a path to a [struct] or [union] item followed by the values for the fields of the item.
30+
A *struct expression* creates a struct, enum, or union value.
31+
It consists of a path to a [struct], [enum], or [union] item followed by the values for the fields of the item.
3232
There are three forms of struct expressions: struct, tuple, and unit.
3333

3434
The following are examples of struct expressions:
@@ -52,7 +52,7 @@ some_fn::<Cookie>(Cookie);
5252
A struct expression with fields enclosed in curly braces allows you to specify the value for each individual field in any order.
5353
The field name is separated from its value with a colon.
5454

55-
A value of a [union] type can also be created using this syntax, except that it must specify exactly one field.
55+
A value of a [union] type can only be created using this syntax, and it must specify exactly one field.
5656

5757
## Functional update syntax
5858

@@ -101,7 +101,8 @@ Point3d { x, y: y_value, z };
101101
## Tuple struct expression
102102

103103
A struct expression with fields enclosed in parentheses constructs a tuple struct.
104-
Though it is listed here as a specific expression for completeness, it is equivalent to a [call expression] to the tuple struct's constructor. For example:
104+
Though it is listed here as a specific expression for completeness, it is equivalent to a [call expression] to the tuple struct's constructor. For example: <!--
105+
This is false. Example: Position(0, ..other_position) -->
105106

106107
```rust
107108
struct Position(i32, i32, i32);
@@ -134,6 +135,7 @@ let b = Gamma{}; // Exact same value as `a`.
134135
[_PathInExpression_]: ../paths.md#paths-in-expressions
135136
[attributes on block expressions]: block-expr.md#attributes-on-block-expressions
136137
[call expression]: call-expr.md
138+
[enum]: ../items/enumerations.md
137139
[if let]: if-expr.md#if-let-expressions
138140
[if]: if-expr.md#if-expressions
139141
[loop]: loop-expr.md

src/items/enumerations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
> _EnumItemDiscriminant_ :\
2626
> &nbsp;&nbsp; `=` [_Expression_]
2727
28-
An *enumeration*, also referred to as *enum* is a simultaneous definition of a
28+
An *enumeration*, also referred to as an *enum*, is a simultaneous definition of a
2929
nominal [enumerated type] as well as a set of *constructors*, that can be used
3030
to create or pattern-match values of the corresponding enumerated type.
3131

src/types/enum.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ An [`enum` item] declares both the type and a number of *variants*, each of
77
which is independently named and has the syntax of a struct, tuple struct or
88
unit-like struct.
99

10-
New instances of an `enum` can be constructed in an [enumeration variant
11-
expression].
10+
New instances of an `enum` can be constructed with a [struct expression].
1211

1312
Any `enum` value consumes as much memory as the largest variant for its
1413
corresponding `enum` type, as well as the size needed to store a discriminant.
@@ -20,4 +19,4 @@ named reference to an [`enum` item].
2019
ML, or a *pick ADT* in Limbo.
2120

2221
[`enum` item]: ../items/enumerations.md
23-
[enumeration variant expression]: ../expressions/enum-variant-expr.md
22+
[struct expression]: ../expressions/struct-expr.md

0 commit comments

Comments
 (0)