@@ -188,8 +188,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
188188 let path_res = if let Some ( & d) = tcx. def_map . borrow ( ) . get ( & pat. id ) {
189189 d
190190 } else if qself. position == 0 {
191- // This is just a sentinel for finish_resolving_def_to_ty.
192191 def:: PathResolution {
192+ // This is just a sentinel for finish_resolving_def_to_ty.
193193 base_def : def:: DefMod ( ast_util:: local_def ( ast:: CRATE_NODE_ID ) ) ,
194194 last_private : LastMod ( AllPublic ) ,
195195 depth : path. segments . len ( )
@@ -616,13 +616,18 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
616616 path_scheme, & ctor_predicates,
617617 opt_ty, def, pat. span , pat. id ) ;
618618
619- let pat_ty = fcx. node_ty ( pat. id ) ;
620- demand:: eqtype ( fcx, pat. span , expected, pat_ty) ;
621-
622619 // If we didn't have a fully resolved path to start with, we had an
623620 // associated const, and we should quit now, since the rest of this
624621 // function uses checks specific to structs and enums.
625- if path_res. depth != 0 { return ; }
622+ if path_res. depth != 0 {
623+ let pat_ty = fcx. node_ty ( pat. id ) ;
624+ demand:: suptype ( fcx, pat. span , expected, pat_ty) ;
625+ return ;
626+ }
627+
628+ let pat_ty = fcx. node_ty ( pat. id ) ;
629+ demand:: eqtype ( fcx, pat. span , expected, pat_ty) ;
630+
626631
627632 let real_path_ty = fcx. node_ty ( pat. id ) ;
628633 let ( arg_tys, kind_name) : ( Vec < _ > , & ' static str ) = match real_path_ty. sty {
0 commit comments