Skip to content

Commit

Permalink
doc cenum_impl_drop_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
ickk authored and ehuss committed Feb 4, 2025
1 parent 4249fb4 commit 2b37679
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/expressions/operator-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ 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.bool-char-as-int]
#### Primitive to integer cast

Expand Down Expand Up @@ -879,6 +882,7 @@ Like assignment expressions, compound assignment expressions always produce [the
[undefined behavior]: ../behavior-considered-undefined.md
[unit]: ../types/tuple.md
[Unit-only enums]: ../items/enumerations.md#unit-only-enum
[cenum_impl_drop_cast]: https://github.com/rust-lang/rust/issues/73333
[value expression]: ../expressions.md#place-expressions-and-value-expressions
[temporary value]: ../expressions.md#temporaries
[this test]: https://github.com/rust-lang/rust/blob/1.58.0/src/test/ui/expr/compound-assignment/eval-order.rs
Expand Down

0 comments on commit 2b37679

Please sign in to comment.