Skip to content

Commit d42bb62

Browse files
committed
Fix patterns.range.constraint-slice
The old text was not correct, since `..b` or `..=b` single-bound patterns were stabilized in rust-lang/rust#124749 and rust-lang/rust#102275.
1 parent 43c4bac commit d42bb62

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/patterns.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,6 @@ It is written as `..=` for an end-inclusive or `..` for an end-exclusive pattern
546546
and has the same type as its upper bound.
547547
For example, `..=10` will match 10, 1, 0, and for signed integer types, all negative values, while `..10` will not match 10.
548548

549-
r[patterns.range.constraint-slice]
550-
Range patterns with only one bound cannot be used as the top-level pattern for subpatterns in [slice patterns](#slice-patterns).
551-
552549
r[patterns.range.bound]
553550
The bounds is written as one of:
554551

@@ -659,6 +656,10 @@ The range of values for an integer type is the closed range from its minimum to
659656
r[patterns.range.refutable-char]
660657
The range of values for a `char` type are precisely those ranges containing all Unicode Scalar Values: `'\u{0000}'..='\u{D7FF}'` and `'\u{E000}'..='\u{10FFFF}'`.
661658

659+
r[patterns.range.constraint-slice]
660+
_RangeFromPattern_ cannot be used as a top-level pattern for subpatterns in [slice patterns](#slice-patterns).
661+
For example, the pattern `[1.., _]` is not a valid pattern.
662+
662663
r[patterns.range.edition2021]
663664
> **Edition differences**: Before the 2021 edition, range patterns with both a lower and upper bound may also be written using `...` in place of `..=`, with the same meaning.
664665

0 commit comments

Comments
 (0)