mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
fix block with no termination in or patterns
This commit is contained in:
parent
8ce5a53934
commit
8593132a43
2 changed files with 26 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue