]> git.proxmox.com Git - rustc.git/blob - src/test/ui/rfc1445/match-forbidden-without-eq.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / rfc1445 / 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 }