about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/middle/resolve.rs1
-rw-r--r--src/test/compile-fail/issue-10200.rs19
2 files changed, 19 insertions, 1 deletions
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 9c06ddca7e8..fad4ef4f15f 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -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(..), _)) => {
diff --git a/src/test/compile-fail/issue-10200.rs b/src/test/compile-fail/issue-10200.rs
new file mode 100644
index 00000000000..2b9ac705f32
--- /dev/null
+++ b/src/test/compile-fail/issue-10200.rs
@@ -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
+        => ()
+    }
+}