Skip to content

Commit f50c66b

Browse files
committed
Add missing rule for non_exhaustive enum cast
This adds a missing rule for this paragraph. It also adds a little more clarity as to what it means.
1 parent eeb03f8 commit f50c66b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/attributes/type_system.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ There are limitations when matching on non-exhaustive types outside of the defin
177177
> }
178178
> ```
179179
180-
It's also not allowed to use numeric casts (`as`) on enums that contain any non-exhaustive variants.
180+
r[attributes.type-system.non_exhaustive.enum-cast]
181+
It is not allowed to use an [`as` numeric cast][expr.as] to [access the discriminant][items.enum.discriminant.coercion] of an external enum that contains any non-exhaustive variants.
181182
182183
> [!EXAMPLE]
183184
> The following enum can be cast because it doesn't contain any non-exhaustive variants:

0 commit comments

Comments
 (0)