summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs
blob: 5dce8180f59206ecd1968ebdb635cdacee400c36 (plain)
1
2
3
4
5
6
7
8
9
10
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);
}