Skip to content

Commit cd00008

Browse files
authored
Merge pull request #2015 from tshepang/tuple-enum-variant
use "tuple enum variant" more consistently
2 parents 8eb20e2 + 9d634f1 commit cd00008

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

src/attributes/type_system.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,15 @@ let message = Message::Send { from: 0, to: 1, contents: "foo".to_string(), };
124124
let message = Message::Reaction(0);
125125
126126
// Cannot construct an instance of `Message::Quit`; if this were converted to
127-
// a tuple-variant `upstream` then this would fail to compile.
127+
// a tuple enum variant `upstream`, this would fail to compile.
128128
let message = Message::Quit;
129129
```
130130

131131
r[attributes.type-system.non_exhaustive.match]
132132
There are limitations when matching on non-exhaustive types outside of the defining crate:
133133

134-
- When pattern matching on a non-exhaustive variant ([`struct`][struct] or [`enum` variant][enum]),
135-
a [StructPattern] must be used which must include a `..`. A tuple variant's constructor's
136-
[visibility] is reduced to be no greater than `pub(crate)`.
137-
- When pattern matching on a non-exhaustive [`enum`][enum], matching on a variant does not
138-
contribute towards the exhaustiveness of the arms.
139-
140-
The following examples of matching do not compile when outside the defining crate:
134+
- When pattern matching on a non-exhaustive variant ([`struct`][struct] or [`enum` variant][enum]), a [StructPattern] must be used which must include a `..`. A tuple enum variant's constructor's [visibility] is reduced to be no greater than `pub(crate)`.
135+
- When pattern matching on a non-exhaustive [`enum`][enum], matching on a variant does not contribute towards the exhaustiveness of the arms. The following examples of matching do not compile when outside the defining crate:
141136

142137
<!-- ignore: requires external crates -->
143138
```rust, ignore

src/destructors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ expression which is one of the following:
483483
* The operand(s) of an extending [array][array expression], [cast][cast
484484
expression], [braced struct][struct expression], or [tuple][tuple expression]
485485
expression.
486-
* The arguments to an extending [tuple struct] or [tuple variant] constructor expression.
486+
* The arguments to an extending [tuple struct] or [tuple enum variant] constructor expression.
487487
* The final expression of an extending [block expression] except for an [async block expression].
488488
* The final expression of an extending [`if`] expression's consequent, `else if`, or `else` block.
489489
* An arm expression of an extending [`match`] expression.
@@ -672,7 +672,7 @@ There is one additional case to be aware of: when a panic reaches a [non-unwindi
672672
[tuple pattern]: patterns.md#tuple-patterns
673673
[tuple struct pattern]: patterns.md#tuple-struct-patterns
674674
[tuple struct]: type.struct.tuple
675-
[tuple variant]: type.enum.declaration
675+
[tuple enum variant]: type.enum.declaration
676676

677677
[array expression]: expressions/array-expr.md#array-expressions
678678
[array repeat operands]: expr.array.repeat-operand

src/items/functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ r[items.fn.const]
280280
## Const functions
281281

282282
r[items.fn.const.intro]
283-
Functions qualified with the `const` keyword are [const functions], as are [tuple struct] and [tuple variant] constructors. _Const functions_ can be called from within [const contexts].
283+
Functions qualified with the `const` keyword are [const functions], as are [tuple struct] and [tuple enum variant] constructors. _Const functions_ can be called from within [const contexts].
284284

285285
r[items.fn.const.extern]
286286
Const functions may use the [`extern`] function qualifier.
@@ -468,7 +468,7 @@ fn foo_oof(#[some_inert_attribute] arg: u8) {
468468
[const contexts]: ../const_eval.md#const-context
469469
[const functions]: ../const_eval.md#const-functions
470470
[tuple struct]: structs.md
471-
[tuple variant]: enumerations.md
471+
[tuple enum variant]: enumerations.md
472472
[`extern`]: #extern-function-qualifier
473473
[external block]: external-blocks.md
474474
[path]: ../paths.md

src/tokens.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,7 @@ TUPLE_INDEX -> DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL
628628
```
629629

630630
r[lex.token.literal.int.tuple-field.intro]
631-
A tuple index is used to refer to the fields of [tuples], [tuple structs], and
632-
[tuple variants].
631+
A tuple index is used to refer to the fields of [tuples], [tuple structs], and [tuple enum variants].
633632

634633
r[lex.token.literal.int.tuple-field.eq]
635634
Tuple indices are compared with the literal token directly. Tuple indices
@@ -1074,7 +1073,7 @@ r[lex.token.reserved-guards.edition2024]
10741073
[trait bounds]: trait-bounds.md
10751074
[tuple index]: expressions/tuple-expr.md#tuple-indexing-expressions
10761075
[tuple structs]: items/structs.md
1077-
[tuple variants]: items/enumerations.md
1076+
[tuple enum variants]: items/enumerations.md
10781077
[tuples]: types/tuple.md
10791078
[unary minus operator]: expressions/operator-expr.md#negation-operators
10801079
[use declarations]: items/use-declarations.md

0 commit comments

Comments
 (0)