Respect binding mode of a binding pattern for exhaustiveness check

This commit is contained in:
iDawer 2021-12-12 14:24:10 +05:00
parent b17aefb83a
commit a9ad7be748
4 changed files with 32 additions and 5 deletions

View file

@ -883,7 +883,20 @@ static __: () = {
match &n { Next(E::Foo | E::Bar) => {} }
match &n { _ | Next(E::Bar) => {} }
};",
);
}
#[test]
fn binding_mode_by_ref() {
check_diagnostics_no_bails(
r"
enum E{ A, B }
fn foo() {
match &E::A {
E::A => {}
x => {}
}
}",
);
}