rust/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
488 B
Rust
Raw Normal View History

2016-03-11 12:36:55 -06:00
#[derive(PartialEq)]
struct Foo {
x: u32
}
const FOO: Foo = Foo { x: 0 };
fn main() {
let y = Foo { x: 1 };
match y {
FOO => { }
2016-03-25 14:14:45 -05:00
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
2016-03-11 12:36:55 -06:00
_ => { }
}
let x = 0.0;
match x {
f32::INFINITY => { }
2018-01-16 02:31:48 -06:00
//~^ WARNING floating-point types cannot be used in patterns
//~| WARNING this was previously accepted by the compiler but is being phased out
2016-03-11 12:36:55 -06:00
_ => { }
}
}