Skip to content

Commit 935a39b

Browse files
committed
rollup merge of #19312: steveklabnik/gh19177
2 parents 8790ab1 + 8369a60 commit 935a39b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/doc/guide.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4013,6 +4013,19 @@ match origin {
40134013
}
40144014
```
40154015

4016+
If you want to match against a slice or array, you can use `[]`:
4017+
4018+
```{rust}
4019+
fn main() {
4020+
let v = vec!["match_this", "1"];
4021+
4022+
match v.as_slice() {
4023+
["match_this", second] => println!("The second element is {}", second),
4024+
_ => {},
4025+
}
4026+
}
4027+
```
4028+
40164029
Whew! That's a lot of different ways to match things, and they can all be
40174030
mixed and matched, depending on what you're doing:
40184031

@@ -5271,7 +5284,7 @@ immediately.
52715284

52725285
## Success and failure
52735286

5274-
Tasks don't always succeed, they can also panic. A task that wishes to panic
5287+
Tasks don't always succeed, they can also panic. A task that wishes to panic
52755288
can call the `panic!` macro, passing a message:
52765289

52775290
```{rust}

0 commit comments

Comments
 (0)