1313>   ;  ; | [ _ IdentifierPattern_ ] \
1414>   ;  ; | [ _ WildcardPattern_ ] \
1515>   ;  ; | [ _ RestPattern_ ] \
16- >   ;  ; | [ _ ObsoleteRangePattern_ ] \
1716>   ;  ; | [ _ ReferencePattern_ ] \
1817>   ;  ; | [ _ StructPattern_ ] \
1918>   ;  ; | [ _ TupleStructPattern_ ] \
@@ -407,7 +406,15 @@ match tuple {
407406
408407> ** <sup >Syntax</sup >** \
409408> _ RangePattern_ :\
410- >   ;  ; _ RangePatternBound_ ` ..= ` _ RangePatternBound_
409+ >   ;  ;   ;  ; _ InclusiveRangePattern_ \
410+ >   ;  ; | _ HalfOpenRangePattern_ \
411+ >   ;  ; | _ ObsoleteRangePattern_
412+ >
413+ > _ InclusiveRangePattern_ :\
414+ >   ;  ;   ;  ; _ RangePatternBound_ ` ..= ` _ RangePatternBound_
415+ >
416+ > _ HalfOpenRangePattern_ :\
417+ >   ;  ; | _ RangePatternBound_ ` .. `
411418>
412419> _ ObsoleteRangePattern_ :\
413420>   ;  ; _ RangePatternBound_ ` ... ` _ RangePatternBound_
@@ -420,11 +427,20 @@ match tuple {
420427>   ;  ; | [ _ PathInExpression_ ] \
421428>   ;  ; | [ _ QualifiedPathInExpression_ ]
422429
423- Range patterns match values that are within the closed range defined by its lower and
424- upper bounds. For example, a pattern ` 'm'..='p' ` will match only the values ` 'm' ` , ` 'n' ` ,
425- ` 'o' ` , and ` 'p' ` . The bounds can be literals or paths that point to constant values.
430+ Range patterns match values within the range defined by their bounds. A range pattern may be
431+ closed or half-open. A range pattern is closed if it has both a lower and an upper bound, and
432+ it matches all the values between and including both of its bounds. A range pattern that is
433+ half-open is written with a lower bound but not an upper bound, and matches any value equal to
434+ or greater than the specified lower bound.
435+
436+ For example, a pattern ` 'm'..='p' ` will match only the values ` 'm' ` , ` 'n' ` , ` 'o' ` , and ` 'p' ` . For an integer the
437+ pattern ` 1.. ` will match 9, or 9001, or 9007199254740991 (if it is of an appropriate size), but
438+ not 0, and not negative numbers for signed integers. The bounds can be literals or paths that point
439+ to constant values.
440+
441+ A half-open range pattern in the style ` a.. ` cannot be used to match within the context of a slice.
426442
427- A pattern a ` ..= ` b must always have a &le ; b. It is an error to have a range pattern
443+ A pattern ` a ..=b ` must always have a &le ; b. It is an error to have a range pattern
428444` 10..=0 ` , for example.
429445
430446The ` ... ` syntax is kept for backwards compatibility.
@@ -456,6 +472,12 @@ println!("{}", match ph {
456472 _ => unreachable! (),
457473});
458474
475+ # let uint : u32 = 5 ;
476+ match uint {
477+ 0 => " zero!" ,
478+ 1 .. => " positive number!" ,
479+ };
480+
459481// using paths to constants:
460482# const TROPOSPHERE_MIN : u8 = 6 ;
461483# const TROPOSPHERE_MAX : u8 = 20 ;
@@ -736,6 +758,10 @@ is irrefutable. When matching a slice, it is irrefutable only in the form with
736758a single ` .. ` [ rest pattern] ( #rest-patterns ) or [ identifier
737759pattern] ( #identifier-patterns ) with the ` .. ` rest pattern as a subpattern.
738760
761+ Within a slice, a half-open range pattern like ` a.. ` must be enclosed in parentheses,
762+ as in ` (a..) ` , to clarify it is intended to match a single value.
763+ A future version of Rust may give the non-parenthesized version an alternate meaning.
764+
739765## Path patterns
740766
741767> ** <sup >Syntax</sup >** \
0 commit comments