@@ -188,8 +188,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
188
188
let path_res = if let Some ( & d) = tcx. def_map . borrow ( ) . get ( & pat. id ) {
189
189
d
190
190
} else if qself. position == 0 {
191
- // This is just a sentinel for finish_resolving_def_to_ty.
192
191
def:: PathResolution {
192
+ // This is just a sentinel for finish_resolving_def_to_ty.
193
193
base_def : def:: DefMod ( ast_util:: local_def ( ast:: CRATE_NODE_ID ) ) ,
194
194
last_private : LastMod ( AllPublic ) ,
195
195
depth : path. segments . len ( )
@@ -616,13 +616,18 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
616
616
path_scheme, & ctor_predicates,
617
617
opt_ty, def, pat. span , pat. id ) ;
618
618
619
- let pat_ty = fcx. node_ty ( pat. id ) ;
620
- demand:: eqtype ( fcx, pat. span , expected, pat_ty) ;
621
-
622
619
// If we didn't have a fully resolved path to start with, we had an
623
620
// associated const, and we should quit now, since the rest of this
624
621
// 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
+
626
631
627
632
let real_path_ty = fcx. node_ty ( pat. id ) ;
628
633
let ( arg_tys, kind_name) : ( Vec < _ > , & ' static str ) = match real_path_ty. sty {
0 commit comments