@@ -442,14 +442,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
442442 ( ty, place)
443443 } ;
444444
445- match ( ty. peel_refs ( ) . kind ( ) , expect_ty. peel_refs ( ) . kind ( ) ) {
446- ( ty:: Slice ( _) , ty:: Array ( elem_ty, _) ) => {
447- ( _, expect) = coerce ( expect_ty, expect, * elem_ty) ;
448- }
449- ( ty:: Array ( elem_ty, _) , ty:: Slice ( _) ) => {
450- ( ty, val) = coerce ( ty, val, * elem_ty) ;
451- }
452- _ => ( ) ,
445+ //match (ty.peel_refs().kind(), expect_ty.peel_refs().kind()) {
446+ // (ty::Slice(_), ty::Array(elem_ty, _)) => {
447+ // (_, expect) = coerce(expect_ty, expect, *elem_ty);
448+ // }
449+ // (ty::Array(elem_ty, _), ty::Slice(_)) => {
450+ // (ty, val) = coerce(ty, val, *elem_ty);
451+ // }
452+ // _ => (),
453+ //}
454+
455+ if let ty:: Array ( elem_ty, _) = ty. peel_refs ( ) . kind ( ) {
456+ ( ty, val) = coerce ( ty, val, * elem_ty) ;
457+ }
458+
459+ if let ty:: Array ( elem_ty, _) = expect_ty. peel_refs ( ) . kind ( ) {
460+ ( _, expect) = coerce ( expect_ty, expect, * elem_ty) ;
453461 }
454462
455463 // Figure out the type on which we are calling `PartialEq`. This involves an extra wrapping
@@ -468,8 +476,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
468476 _ => span_bug ! ( source_info. span, "invalid type for non-scalar compare: {}" , ty) ,
469477 } ;
470478
471- let eq_def_id = self . tcx . require_lang_item ( LangItem :: PartialEq , Some ( source_info. span ) ) ;
472- let method = trait_method ( self . tcx , eq_def_id, sym:: eq , [ compare_ty, compare_ty] ) ;
479+ let eq_def_id = self . tcx . require_lang_item ( LangItem :: MatchLoweredCmp , Some ( source_info. span ) ) ;
480+ let method = trait_method ( self . tcx , eq_def_id, sym:: do_match , [ compare_ty, compare_ty] ) ;
473481
474482 let bool_ty = self . tcx . types . bool ;
475483 let eq_result = self . temp ( bool_ty, source_info. span ) ;
0 commit comments