about summary refs log tree commit diff
path: root/tests/ui/cenum_impl_drop_cast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/cenum_impl_drop_cast.rs')
-rw-r--r--tests/ui/cenum_impl_drop_cast.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/cenum_impl_drop_cast.rs b/tests/ui/cenum_impl_drop_cast.rs
new file mode 100644
index 00000000000..96e3d967e2c
--- /dev/null
+++ b/tests/ui/cenum_impl_drop_cast.rs
@@ -0,0 +1,18 @@
+#![deny(cenum_impl_drop_cast)]
+
+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`
+    //~| WARN this was previously accepted
+}