Skip to content

Commit 98d3e84

Browse files
committed
doc cenum_impl_drop_cast
1 parent 293af99 commit 98d3e84

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/expressions/operator-expr.md

+4
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ assert_eq!(Enum::B as i32, 1);
503503
assert_eq!(Enum::C as i32, 2);
504504
```
505505

506+
> [!WARNING]
507+
> By default [enum casts are not allowed for enums which implement `Drop`][cenum_impl_drop_cast].
508+
506509
#### Primitive to integer cast
507510

508511
* `false` casts to `0`, `true` casts to `1`
@@ -738,6 +741,7 @@ Like assignment expressions, compound assignment expressions always produce [the
738741
[undefined behavior]: ../behavior-considered-undefined.md
739742
[unit]: ../types/tuple.md
740743
[Unit-only enums]: ../items/enumerations.md#unit-only-enum
744+
[cenum_impl_drop_cast]: https://github.com/rust-lang/rust/issues/73333
741745
[value expression]: ../expressions.md#place-expressions-and-value-expressions
742746
[temporary value]: ../expressions.md#temporaries
743747
[this test]: https://github.com/rust-lang/rust/blob/1.58.0/src/test/ui/expr/compound-assignment/eval-order.rs

0 commit comments

Comments
 (0)