Skip to content

Commit 3d8c561

Browse files
committed
Update error_codes.rs with new subslice syntax.
1 parent 165951b commit 3d8c561

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_typeck/error_codes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3497,8 +3497,8 @@ Example of erroneous code:
34973497
34983498
let r = &[1, 2];
34993499
match r {
3500-
&[a, b, c, rest..] => { // error: pattern requires at least 3
3501-
// elements but array has 2
3500+
&[a, b, c, rest @ ..] => { // error: pattern requires at least 3
3501+
// elements but array has 2
35023502
println!("a={}, b={}, c={} rest={:?}", a, b, c, rest);
35033503
}
35043504
}
@@ -3512,7 +3512,7 @@ requires. You can match an arbitrary number of remaining elements with `..`:
35123512
35133513
let r = &[1, 2, 3, 4, 5];
35143514
match r {
3515-
&[a, b, c, rest..] => { // ok!
3515+
&[a, b, c, rest @ ..] => { // ok!
35163516
// prints `a=1, b=2, c=3 rest=[4, 5]`
35173517
println!("a={}, b={}, c={} rest={:?}", a, b, c, rest);
35183518
}

0 commit comments

Comments
 (0)