-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: Stop leaking enum variants into children
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 [breaking-change]
- Loading branch information
1 parent
25c5422
commit 7cbec55
Showing
10 changed files
with
52 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
7cbec55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pcwalton
at alexcrichton@7cbec55
7cbec55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-14221 = 7cbec55 into auto
7cbec55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-14221 = 7cbec55 merged ok, testing candidate = 3da5a5c
7cbec55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/5824
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/5822
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/4917
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/4926
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5921
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/5010
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/5018
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/5924
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/5009
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/5015
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/5077
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2810
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/5917
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/5013
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/5028
7cbec55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 3da5a5c