@@ -358,33 +358,12 @@ BaseType::satisfies_bound (const TypeBoundPredicate &predicate, bool emit_error)
358
358
const auto *item_ref = lookup->get_raw_item ();
359
359
TyTy::BaseType *bound_ty = item_ref->get_tyty ();
360
360
361
- // compare the types
362
- if (!bound_ty->can_eq (impl_item_ty, false ))
363
- {
364
- if (!impl_item_ty->can_eq (bound_ty, false ))
365
- {
366
- if (emit_error)
367
- {
368
- rich_location r (line_table,
369
- mappings.lookup_location (get_ref ()));
370
- r.add_range (predicate.get_locus ());
371
- r.add_range (mappings.lookup_location (i.get_hirid ()));
372
-
373
- std::string rich_msg
374
- = " expected " + bound_ty->destructure ()->get_name ()
375
- + " , found "
376
- + impl_item_ty->destructure ()->get_name ();
377
- r.add_fixit_replace (rich_msg.c_str ());
378
-
379
- rust_error_at (
380
- r, ErrorCode::E0271 ,
381
- " type mismatch, expected %qs but got %qs" ,
382
- bound_ty->destructure ()->get_name ().c_str (),
383
- impl_item_ty->destructure ()->get_name ().c_str ());
384
- }
385
- return false ;
386
- }
387
- }
361
+ if (!Resolver::types_compatable (
362
+ TyTy::TyWithLocation (bound_ty, predicate.get_locus ()),
363
+ TyTy::TyWithLocation (impl_item_ty, item->get_locus ()),
364
+ mappings.lookup_location (get_ref ()), false /* emit-error*/ ,
365
+ false /* check-bounds*/ ))
366
+ return false ;
388
367
}
389
368
390
369
return true ;
0 commit comments