Do not accept functions in enum patterns past resolve
This commit is contained in:
parent
083578ddec
commit
3e9ce5afb7
2 changed files with 19 additions and 1 deletions
|
|
@ -5077,7 +5077,6 @@ impl<'a> Resolver<'a> {
|
|||
PatEnum(ref path, _) => {
|
||||
// This must be an enum variant, struct or const.
|
||||
match self.resolve_path(pat_id, path, ValueNS, false) {
|
||||
Some(def @ (DefFn(..), _)) |
|
||||
Some(def @ (DefVariant(..), _)) |
|
||||
Some(def @ (DefStruct(..), _)) |
|
||||
Some(def @ (DefConst(..), _)) => {
|
||||
|
|
|
|||
19
src/test/compile-fail/issue-10200.rs
Normal file
19
src/test/compile-fail/issue-10200.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// 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.
|
||||
|
||||
struct Foo(bool);
|
||||
fn foo(_: uint) -> Foo { Foo(false) }
|
||||
|
||||
fn main() {
|
||||
match Foo(true) {
|
||||
foo(x) //~ ERROR `foo` is not an enum variant, struct or const
|
||||
=> ()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue