]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs
Rollup merge of #94689 - compiler-errors:on-unimplemented-substs, r=petrochenkov
[rust.git] / src / test / ui / rfc-2008-non-exhaustive / enum-as-cast.rs
1 // aux-build:enums.rs
2 // run-pass
3
4 extern crate enums;
5
6 use enums::FieldLessWithNonExhaustiveVariant;
7
8 fn main() {
9     let e = FieldLessWithNonExhaustiveVariant::default();
10     // FIXME: https://github.com/rust-lang/rust/issues/91161
11     // This `as` cast *should* be an error, since it would fail
12     // if the non-exhaustive variant got fields.  But today it
13     // doesn't.  The fix for that will update this test to
14     // show an error (and not be run-pass any more).
15     let d = e as u8;
16     assert_eq!(d, 0);
17 }