]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-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-nonempty-array-forbidden-without-eq.rs
1 // Issue 62307 pointed out a case where the structural-match checking
2 // was too shallow.
3 //
4 // Here we check similar behavior for non-empty arrays of types that
5 // do not derive `Eq`.
6 //
7 // (Current behavior for empty arrays differs and thus is not tested
8 // here; see rust-lang/rust#62336.)
9
10 #[derive(PartialEq, Debug)]
11 struct B(i32);
12
13 fn main() {
14     const FOO: [B; 1] = [B(0)];
15     match [B(1)] {
16         FOO => { }
17         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
18     }
19 }