diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 9c06ddca7e8a..fad4ef4f15f6 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 000000000000..2b9ac705f321 --- /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 or the MIT license +// , 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 + => () + } +}