fix block with no termination in or patterns

This commit is contained in:
hkalbasi 2023-03-09 22:30:27 +03:30
parent 8ce5a53934
commit 8593132a43
2 changed files with 26 additions and 1 deletions

View file

@ -574,6 +574,27 @@ fn main() {
);
}
#[test]
fn or_pattern_no_terminator() {
check_diagnostics(
r#"
enum Foo {
A, B, C, D
}
use Foo::*;
fn f(inp: (Foo, Foo, Foo, Foo)) {
let ((A, B, _, x) | (B, C | D, x, _)) = inp else {
return;
};
x = B;
//^^^^^ 💡 error: cannot mutate immutable variable `x`
}
"#,
);
}
#[test]
fn respect_allow_unused_mut() {
// FIXME: respect