2019-10-08 08:54:37 -05:00
|
|
|
// Issue 61188 pointed out a case where we hit an ICE during code gen:
|
2019-07-03 09:54:08 -05:00
|
|
|
// the compiler assumed that `PartialEq` was always implemented on any
|
|
|
|
// use of a `const` item in a pattern context, but the pre-existing
|
2020-03-24 13:52:22 -05:00
|
|
|
// structural-match checking was too shallow
|
2019-07-03 09:54:08 -05:00
|
|
|
// (see rust-lang/rust#62307), and so we hit cases where we were
|
|
|
|
// trying to dispatch to `PartialEq` on types that did not implement
|
|
|
|
// that trait.
|
|
|
|
|
|
|
|
struct B(i32);
|
|
|
|
|
|
|
|
const A: &[B] = &[];
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
match &[][..] {
|
|
|
|
A => (),
|
|
|
|
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|