diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 9ba1d2523c6..852eb1b50a4 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -551,6 +551,8 @@ pub fn specialize(cx: @MatchCheckCtxt, Some(vec::append(args, vec::from_slice(r.tail()))) } def_variant(_, _) => None, + + def_fn(*) | def_struct(*) => { // FIXME #4731: Is this right? --pcw let new_args; diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 49c5717a357..1d0fc705324 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -915,6 +915,7 @@ pub impl mem_categorization_ctxt { self.cat_pattern(subcmt, *subpat, op); } } + Some(&ast::def_fn(*)) | Some(&ast::def_struct(*)) => { for subpats.each |subpat| { let cmt_field = self.cat_anon_struct_field(*subpat, diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 5354ffc5d3c..d56474df2b0 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -4279,6 +4279,7 @@ pub impl Resolver { pat_enum(path, _) => { // This must be an enum variant, struct or const. match self.resolve_path(path, ValueNS, false, visitor) { + Some(def @ def_fn(*)) | Some(def @ def_variant(*)) | Some(def @ def_struct(*)) | Some(def @ def_const(*)) => { diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index e31ad63953e..3755cca8c35 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -291,6 +291,7 @@ pub fn variant_opt(bcx: block, pat_id: ast::node_id) } ::core::util::unreachable(); } + ast::def_fn(*) | ast::def_struct(_) => { return lit(UnitLikeStructLit(pat_id)); } @@ -818,6 +819,7 @@ pub fn get_options(bcx: block, m: &[@Match], col: uint) -> ~[Opt] { // This could be one of: a tuple-like enum variant, a // struct-like enum variant, or a struct. match ccx.tcx.def_map.find(&cur.id) { + Some(&ast::def_fn(*)) | Some(&ast::def_variant(*)) => { add_to_set(ccx.tcx, &mut found, variant_opt(bcx, cur.id)); @@ -1011,6 +1013,7 @@ pub fn any_tuple_struct_pat(bcx: block, m: &[@Match], col: uint) -> bool { match pat.node { ast::pat_enum(_, Some(_)) => { match bcx.tcx().def_map.find(&pat.id) { + Some(&ast::def_fn(*)) | Some(&ast::def_struct(*)) => true, _ => false } @@ -1780,6 +1783,7 @@ pub fn bind_irrefutable_pat(bcx: block, } } } + Some(&ast::def_fn(*)) | Some(&ast::def_struct(*)) => { match *sub_pats { None => {