diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-09-26 21:13:20 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-09-30 09:11:26 -0700 |
| commit | 416144b8279fbffceacea6d0fd90e0fd1f8ce53d (patch) | |
| tree | 0f7f628dd1388f378ac4836e32359b18a7297212 /src/doc | |
| parent | 38015eeb7010e5954a1bc60fddc1214a5f359627 (diff) | |
librustc: Forbid `..` in range patterns.
This breaks code that looks like:
match foo {
1..3 => { ... }
}
Instead, write:
match foo {
1...3 => { ... }
}
Closes #17295.
[breaking-change]
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/guide.md | 8 | ||||
| -rw-r--r-- | src/doc/reference.md | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md index 0474e5a31ce..074dfc17b0d 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -3757,27 +3757,27 @@ match x { } ``` -You can match a range of values with `..`: +You can match a range of values with `...`: ```{rust} let x = 1i; match x { - 1 .. 5 => println!("one through five"), + 1 ... 5 => println!("one through five"), _ => println!("anything"), } ``` Ranges are mostly used with integers and single characters. -If you're matching multiple things, via a `|` or a `..`, you can bind +If you're matching multiple things, via a `|` or a `...`, you can bind the value to a name with `@`: ```{rust} let x = 1i; match x { - x @ 1 .. 5 => println!("got {}", x), + x @ 1 ... 5 => println!("got {}", x), _ => println!("anything"), } ``` diff --git a/src/doc/reference.md b/src/doc/reference.md index 21da810a300..8fa282c2a39 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -3408,7 +3408,7 @@ may be specified with `..`. For example: let message = match x { 0 | 1 => "not many", - 2 .. 9 => "a few", + 2 ... 9 => "a few", _ => "lots" }; ``` |
