use std::ops::Deref; struct Foo { v: Vec, } struct Bar { v: Vec, } impl Deref for Bar { type Target = Vec; fn deref(&self) -> &Self::Target { &self.v } } fn f(foo: &Foo) { match foo { Foo { v: [1, 2] } => {} //~^ ERROR expected an array or slice, found `Vec _ => {} } } fn bar(bar: &Bar) { match bar { Bar { v: [1, 2] } => {} //~^ ERROR expected an array or slice, found `Vec _ => {} } } fn main() {}