]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.rs
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
[rust.git] / src / test / ui / rfc-1445-restrict-constants-in-patterns / issue-61188-match-slice-forbidden-without-eq.rs
1 // Issue 61188 pointed out a case where we hit an ICE during code gen:
2 // the compiler assumed that `PartialEq` was always implemented on any
3 // use of a `const` item in a pattern context, but the pre-existing
4 // structural-match checking was too shallow
5 // (see rust-lang/rust#62307), and so we hit cases where we were
6 // trying to dispatch to `PartialEq` on types that did not implement
7 // that trait.
8
9 struct B(i32);
10
11 const A: &[B] = &[];
12
13 pub fn main() {
14     match &[][..] {
15         A => (),
16         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
17         _ => (),
18     }
19 }