File tree 2 files changed +39
-0
lines changed
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -3539,6 +3539,19 @@ impl<'a> Parser<'a> {
3539
3539
self . bump ( ) ;
3540
3540
pat = PatStruct ( enum_path, fields, etc) ;
3541
3541
}
3542
+ token:: DotDotDot => {
3543
+ let hi = self . last_span . hi ;
3544
+ let start = self . mk_expr ( lo, hi, ExprPath ( enum_path) ) ;
3545
+ self . eat ( & token:: DotDotDot ) ;
3546
+ let end = if self . token . is_ident ( ) || self . token . is_path ( ) {
3547
+ let path = self . parse_path ( LifetimeAndTypesWithColons ) ;
3548
+ let hi = self . span . hi ;
3549
+ self . mk_expr ( lo, hi, ExprPath ( path) )
3550
+ } else {
3551
+ self . parse_literal_maybe_minus ( )
3552
+ } ;
3553
+ pat = PatRange ( start, end) ;
3554
+ }
3542
3555
_ => {
3543
3556
let mut args: Vec < P < Pat > > = Vec :: new ( ) ;
3544
3557
match self . token {
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ use m:: { START , END } ;
12
+
13
+ fn main ( ) {
14
+ match 42u32 {
15
+ m:: START ...m:: END => { } ,
16
+ // FIXME: Should also work (now: mismatched types in range [E0031])
17
+ // 0u32...m::END => {},
18
+ // m::START...59u32 => {},
19
+ _ => { } ,
20
+ }
21
+ }
22
+
23
+ mod m {
24
+ pub const START : u32 = 4 ;
25
+ pub const END : u32 = 14 ;
26
+ }
You can’t perform that action at this time.
0 commit comments