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 committed Jan 14, 2025
1 parent 293af99 commit 98d3e84
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 @@ -503,6 +503,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].
#### Primitive to integer cast

* `false` casts to `0`, `true` casts to `1`
Expand Down Expand Up @@ -738,6 +741,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 98d3e84

Please sign in to comment.