Skip to content

Commit 2b37679

Browse files
ickkehuss
authored andcommitted
doc cenum_impl_drop_cast
1 parent 4249fb4 commit 2b37679

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
@@ -599,6 +599,9 @@ assert_eq!(Enum::B as i32, 1);
599599
assert_eq!(Enum::C as i32, 2);
600600
```
601601

602+
> [!WARNING]
603+
> By default [enum casts are not allowed for enums which implement `Drop`][cenum_impl_drop_cast].
604+
602605
r[expr.as.bool-char-as-int]
603606
#### Primitive to integer cast
604607

@@ -879,6 +882,7 @@ Like assignment expressions, compound assignment expressions always produce [the
879882
[undefined behavior]: ../behavior-considered-undefined.md
880883
[unit]: ../types/tuple.md
881884
[Unit-only enums]: ../items/enumerations.md#unit-only-enum
885+
[cenum_impl_drop_cast]: https://github.com/rust-lang/rust/issues/73333
882886
[value expression]: ../expressions.md#place-expressions-and-value-expressions
883887
[temporary value]: ../expressions.md#temporaries
884888
[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)