]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
[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 this was previously accepted by the compiler but is being phased out
21         _ => { }
22     }
23 }