Rollup merge of #36121 - Cobrand:master, r=jonathandturner
Updated E0527 to new error format * Closes #36113
This commit is contained in:
commit
613f35051f
@ -233,9 +233,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
let min_len = before.len() + after.len();
|
||||
if slice.is_none() {
|
||||
if min_len != size {
|
||||
span_err!(tcx.sess, pat.span, E0527,
|
||||
"pattern requires {} elements but array has {}",
|
||||
min_len, size);
|
||||
struct_span_err!(
|
||||
tcx.sess, pat.span, E0527,
|
||||
"pattern requires {} elements but array has {}",
|
||||
min_len, size)
|
||||
.span_label(pat.span, &format!("expected {} elements",size))
|
||||
.emit();
|
||||
}
|
||||
(inner_ty, tcx.types.err)
|
||||
} else if let Some(rest) = size.checked_sub(min_len) {
|
||||
|
@ -13,7 +13,9 @@
|
||||
fn main() {
|
||||
let r = &[1, 2, 3, 4];
|
||||
match r {
|
||||
&[a, b] => { //~ ERROR E0527
|
||||
&[a, b] => {
|
||||
//~^ ERROR E0527
|
||||
//~| NOTE expected 4 elements
|
||||
println!("a={}, b={}", a, b);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user