Skip to content

Commit

Permalink
Update now that cenum_impl_drop_cast is a hard error
Browse files Browse the repository at this point in the history
cenum_impl_drop_cast has been changed to a hard error in
rust-lang/rust#135964
  • Loading branch information
ehuss committed Feb 4, 2025
1 parent 2b37679 commit 350536c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/expressions/operator-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ halfway between two floating point numbers.
r[expr.as.enum]
#### Enum cast

r[expr.as.enum.discriminant]
Casts an enum to its discriminant, then uses a numeric cast if needed.
Casting is limited to the following kinds of enumerations:

Expand All @@ -599,8 +600,8 @@ assert_eq!(Enum::B as i32, 1);
assert_eq!(Enum::C as i32, 2);
```

> [!WARNING]
> By default [enum casts are not allowed for enums which implement `Drop`][cenum_impl_drop_cast].
r[expr.as.enum.no-drop]
Casting is not allowed if the enum implements [`Drop`].

r[expr.as.bool-char-as-int]
#### Primitive to integer cast
Expand Down

0 comments on commit 350536c

Please sign in to comment.