Reference patterns are always irrefutable.
The reference show this code.
let int_reference = &3;
let a = match *int_reference { 0 => "zero", _ => "some" };
let b = match int_reference { &0 => "zero", _ => "some" };
assert_eq!(a, b);
If reference patterns would be irrefutable, then the _ => "some" arm would never execute since &0 is irrefutable and matching anything, but of course this is not true.
It seems like for me is that reference pattern is only irrefutable if the subpattern is irrefutable. For example &x (identifier pattern) would be indeed irrefutable since x is irrefutable.
Am I right or am I missing something?
>Solution :
You are correct. Reference patterns by themselves are irrefutable, but other parts of the whole pattern may be refutable.