Skip to content

Commit 7b8baa6

Browse files
committed
Reword attributes.type-system.non_exhaustive.construction
The original felt a little awkward with how it differentiated between enum and enum variants. I also wasn't terribly happy with using a list here.
1 parent e69fe00 commit 7b8baa6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/attributes/type_system.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ Within the defining crate, `non_exhaustive` has no effect.
8888
> ```
8989
9090
r[attributes.type-system.non_exhaustive.construction]
91-
Non-exhaustive types cannot be constructed outside of the defining crate:
91+
`non_exhaustive` applied to a [`struct`][struct] or [`enum` variant][enum] prevents constructing that struct or enum variant outside of the defining crate.
9292
93-
- Non-exhaustive variants ([`struct`][struct] or [`enum` variant][enum]) cannot be constructed with a [StructExpression] \(including with [functional update syntax]).
94-
- The implicitly defined same-named constant of a [unit-like struct][struct], or the same-named constructor function of a [tuple struct][struct], has a [visibility] no greater than `pub(crate)`. That is, if the structs visibility is `pub`, then the constant or constructors visibility is `pub(crate)`, and otherwise the visibility of the two items is the same (as is the case without `#[non_exhaustive]`).
95-
- [`enum`][enum] instances can be constructed.
93+
Non-exhaustive variants ([`struct`][struct] or [`enum` variant][enum]) cannot be constructed with a [StructExpression] \(including with [functional update syntax]).
94+
95+
The implicitly defined same-named constant of a [unit-like struct][struct], or the same-named constructor function of a [tuple struct][struct], has a [visibility] no greater than `pub(crate)`. That is, if the structs visibility is `pub`, then the constant or constructors visibility is `pub(crate)`, and otherwise the visibility of the two items is the same (as is the case without `#[non_exhaustive]`).
9696
9797
> [!EXAMPLE]
9898
> Using the definitions from [above][attributes.type-system.non_exhaustive.intro], the following examples of construction do not compile when outside the defining crate:

0 commit comments

Comments
 (0)