Fix missing terminator for slice pattern

This commit is contained in:
hkalbasi 2023-06-04 20:59:27 +03:30
parent 0408af6453
commit b4907a531f
2 changed files with 70 additions and 45 deletions

View file

@ -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(