auto merge of #14253 : alexcrichton/rust/issue-14221, r=pcwalton
This plugs a leak where resolve was treating enums defined in parent modules as in-scope for all children modules when resolving a pattern identifier. This eliminates the code path in resolve entirely. If this breaks any existing code, then it indicates that the variants need to be explicitly imported into the module. Closes #14221
This commit is contained in:
commit
3da5a5cd18
10 changed files with 52 additions and 42 deletions
25
src/test/compile-fail/issue-14221.rs
Normal file
25
src/test/compile-fail/issue-14221.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub enum E {
|
||||
A,
|
||||
B,
|
||||
}
|
||||
|
||||
pub mod b {
|
||||
pub fn key(e: ::E) -> &'static str {
|
||||
match e {
|
||||
A => "A",
|
||||
B => "B", //~ ERROR: unreachable pattern
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue