]> git.proxmox.com Git - rustc.git/blob - src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs
New upstream version 1.55.0+dfsg1
[rustc.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 this was previously accepted by the compiler but is being phased out
21 _ => { }
22 }
23 }