@@ -462,9 +462,8 @@ let rec match_name_with_generics (ctx : 'fun_body ctx) (c : match_config)
462462 in
463463 match (p, n) with
464464 | [] , [] ->
465- raise
466- (Failure
467- " match_name_with_generics: attempt to match empty names and patterns" )
465+ failwith
466+ " match_name_with_generics: attempt to match empty names and patterns"
468467 (* We shouldn't get there: the names/patterns should be non empty *)
469468 | [ PIdent (pid, pd, pg) ], [ PeIdent (id, d) ] ->
470469 log#ldebug
@@ -489,6 +488,7 @@ let rec match_name_with_generics (ctx : 'fun_body ctx) (c : match_config)
489488 | ImplElemTrait impl_id ->
490489 match_expr_with_trait_impl_id ctx c pty impl_id
491490 && g = TypesUtils. empty_generic_args)
491+ | [ PWild ], [ _ ] -> true
492492 | PIdent (pid , pd , pg ) :: p , PeIdent (id , d ) :: n ->
493493 (* This is not the end: check that the generics are empty *)
494494 pid = id
@@ -543,6 +543,7 @@ and match_pattern_with_literal_type (pty : pattern) (ty : T.literal_type) : bool
543543 let ty = literal_type_to_string ty in
544544 match pty with
545545 | [ PIdent (ty', _, [] ) ] when ty = ty' -> true
546+ | [ PWild ] -> true
546547 | _ -> false
547548
548549and match_primitive_adt (pid : primitive_adt ) (id : T.type_id ) : bool =
@@ -622,6 +623,7 @@ and match_trait_decl_ref_item (ctx : 'fun_body ctx) (c : match_config)
622623 | PIdent (pitem_name , pd , pgenerics ) ->
623624 pitem_name = item_name && pd = 0
624625 && match_generic_args ctx c (mk_empty_maps () ) pgenerics generics
626+ | PWild -> true
625627 | _ -> false
626628 else raise (Failure " Unimplemented" )
627629
@@ -1282,6 +1284,7 @@ let rec pattern_common_prefix_aux (c : conv_config) (m : conv_map option)
12821284and pattern_elem_convertible_aux (c : conv_config ) (m : conv_map option )
12831285 (p0 : pattern_elem ) (p1 : pattern_elem ) : (conv_map option, unit) result =
12841286 match (p0, p1) with
1287+ | PWild , _ | _ , PWild -> Ok m
12851288 | PIdent (s0 , d0 , g0 ), PIdent (s1 , d1 , g1 ) ->
12861289 if s0 = s1 && d0 = d1 then
12871290 match m with
0 commit comments