diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-06-03 20:59:42 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-06-04 19:32:06 +0500 |
| commit | 06ab34e51604ae09d56b42cb4576a87dd44db5be (patch) | |
| tree | d299949dbabf571c5dfeb88af58d819dc4b2c3b0 /tests/ui/enum/enum-drop-cast-error.rs | |
| parent | aae43c4532690153af7465227816c93036bb1604 (diff) | |
| download | rust-06ab34e51604ae09d56b42cb4576a87dd44db5be.tar.gz rust-06ab34e51604ae09d56b42cb4576a87dd44db5be.zip | |
cleaned up some tests
Diffstat (limited to 'tests/ui/enum/enum-drop-cast-error.rs')
| -rw-r--r-- | tests/ui/enum/enum-drop-cast-error.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/enum/enum-drop-cast-error.rs b/tests/ui/enum/enum-drop-cast-error.rs new file mode 100644 index 00000000000..36101573624 --- /dev/null +++ b/tests/ui/enum/enum-drop-cast-error.rs @@ -0,0 +1,19 @@ +//! Check that trying to cast an enum with a Drop impl to an integer is rejected. +//! +//! Issue: <https://github.com/rust-lang/rust/issues/35941> + +enum E { + A = 0, +} + +impl Drop for E { + fn drop(&mut self) { + println!("Drop"); + } +} + +fn main() { + let e = E::A; + let i = e as u32; + //~^ ERROR cannot cast enum `E` into integer `u32` because it implements `Drop` +} |
