mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Fix missing terminator for slice pattern
This commit is contained in:
parent
0408af6453
commit
b4907a531f
2 changed files with 70 additions and 45 deletions
|
@ -993,6 +993,27 @@ fn f() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slice_pattern() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
//- minicore: coerce_unsized, deref_mut, slice, copy
|
||||
fn x(t: &[u8]) {
|
||||
match t {
|
||||
&[a, mut b] | &[a, _, mut b] => {
|
||||
//^^^^^ 💡 weak: variable does not need to be mutable
|
||||
|
||||
a = 2;
|
||||
//^^^^^ 💡 error: cannot mutate immutable variable `a`
|
||||
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn boxes() {
|
||||
check_diagnostics(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue