Skip to content
/ rust Public
forked from rust-lang/rust

Commit 9e2bb9d

Browse files
committed
auto merge of rust-lang#15862 : jakub-/rust/issue-15774, r=alexcrichton
Fixed rust-lang#15774.
2 parents 221c28a + ad30579 commit 9e2bb9d

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3101,7 +3101,7 @@ impl<'a> Parser<'a> {
31013101
}
31023102
},
31033103
_ => {
3104-
if enum_path.segments.len() == 1 {
3104+
if !enum_path.global && enum_path.segments.len() == 1 {
31053105
// it could still be either an enum
31063106
// or an identifier pattern, resolve
31073107
// will sort it out:

src/test/run-pass/issue-15774.rs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
#![deny(warnings)]
12+
#![allow(unused_imports)]
13+
14+
enum Foo { A }
15+
mod bar {
16+
pub fn normal(x: ::Foo) {
17+
use A;
18+
match x {
19+
A => {}
20+
}
21+
}
22+
pub fn wrong(x: ::Foo) {
23+
match x {
24+
::A => {}
25+
}
26+
}
27+
}
28+
29+
pub fn main() {
30+
bar::normal(A);
31+
bar::wrong(A);
32+
}

0 commit comments

Comments
 (0)