File tree 2 files changed +52
-1
lines changed
2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -2920,7 +2920,7 @@ impl<'a> Parser<'a> {
2920
2920
_ => { }
2921
2921
}
2922
2922
2923
- if !is_ident_or_path ( & self . token )
2923
+ if ( !is_ident_or_path ( & self . token ) && self . token != token :: MOD_SEP )
2924
2924
|| self . is_keyword ( keywords:: True )
2925
2925
|| self . is_keyword ( keywords:: False ) {
2926
2926
// Parse an expression pattern or exp .. exp.
Original file line number Diff line number Diff line change
1
+ // Copyright 2012-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
+ enum Foo {
12
+ Bar ( int ) ,
13
+ Baz ,
14
+ }
15
+
16
+ enum Other {
17
+ Other1 ( Foo ) ,
18
+ Other2 ( Foo , Foo ) ,
19
+ }
20
+
21
+ fn main ( ) {
22
+ match Baz {
23
+ :: Bar ( 3 ) => fail ! ( ) ,
24
+ :: Bar ( _) if false => fail ! ( ) ,
25
+ :: Bar ( ..) if false => fail ! ( ) ,
26
+ :: Bar ( _n) => fail ! ( ) ,
27
+ :: Baz => { }
28
+ }
29
+ match Bar ( 3 ) {
30
+ :: Bar ( 3 ) => { }
31
+ :: Bar ( _) if false => fail ! ( ) ,
32
+ :: Bar ( ..) if false => fail ! ( ) ,
33
+ :: Bar ( _n) => fail ! ( ) ,
34
+ :: Baz => fail ! ( ) ,
35
+ }
36
+ match Bar ( 4 ) {
37
+ :: Bar ( 3 ) => fail ! ( ) ,
38
+ :: Bar ( _) if false => fail ! ( ) ,
39
+ :: Bar ( ..) if false => fail ! ( ) ,
40
+ :: Bar ( n) => assert_eq ! ( n, 4 ) ,
41
+ :: Baz => fail ! ( ) ,
42
+ }
43
+
44
+ match Other1 ( Baz ) {
45
+ :: Other1 ( :: Baz ) => { }
46
+ :: Other1 ( :: Bar ( _) ) => { }
47
+ :: Other2 ( :: Baz , :: Bar ( _) ) => { }
48
+ :: Other2 ( :: Bar ( ..) , :: Baz ) => { }
49
+ :: Other2 ( ..) => { }
50
+ }
51
+ }
You can’t perform that action at this time.
0 commit comments