]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs
1cca27520618d531e7ce2f964320e1c3f9ad1162
[rust.git] / src / test / ui / rfc-1445-restrict-constants-in-patterns / match-forbidden-without-eq.rs
1 use std::f32;
2
3 #[derive(PartialEq)]
4 struct Foo {
5     x: u32
6 }
7
8 const FOO: Foo = Foo { x: 0 };
9
10 fn main() {
11     let y = Foo { x: 1 };
12     match y {
13         FOO => { }
14         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
15         _ => { }
16     }
17
18     let x = 0.0;
19     match x {
20         f32::INFINITY => { }
21         //~^ WARNING floating-point types cannot be used in patterns
22         //~| WARNING will become a hard error in a future release
23         //~| WARNING floating-point types cannot be used in patterns
24         //~| WARNING this was previously accepted by the compiler but is being phased out
25         _ => { }
26     }
27 }