summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2008-non-exhaustive/enum-as-cast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfc-2008-non-exhaustive/enum-as-cast.rs')
-rw-r--r--tests/ui/rfc-2008-non-exhaustive/enum-as-cast.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/rfc-2008-non-exhaustive/enum-as-cast.rs b/tests/ui/rfc-2008-non-exhaustive/enum-as-cast.rs
new file mode 100644
index 000000000..5dce8180f
--- /dev/null
+++ b/tests/ui/rfc-2008-non-exhaustive/enum-as-cast.rs
@@ -0,0 +1,11 @@
+// aux-build:enums.rs
+
+extern crate enums;
+
+use enums::FieldLessWithNonExhaustiveVariant;
+
+fn main() {
+ let e = FieldLessWithNonExhaustiveVariant::default();
+ let d = e as u8; //~ ERROR casting `FieldLessWithNonExhaustiveVariant` as `u8` is invalid [E0606]
+ assert_eq!(d, 0);
+}