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