]> git.lizzy.rs Git - rust.git/blob - src/test/ui/enum/enum-to-float-cast-2.rs
Rollup merge of #100479 - compiler-errors:argument-type-error-improvements, r=lcnr
[rust.git] / src / test / ui / enum / enum-to-float-cast-2.rs
1 // Tests that enum-to-float casts are disallowed.
2
3 enum E {
4     L0 = -1,
5     H0 = 1
6 }
7
8 enum F {
9     L1 = 1,
10     H1 = 0xFFFFFFFFFFFFFFFF
11 }
12
13 pub fn main() {
14     let a = E::L0 as f32;  //~ ERROR casting
15     let c = F::H1 as f32;  //~ ERROR casting
16     assert_eq!(a, -1.0f32);
17     assert_eq!(c, -1.0f32);
18 }