Skip to content

Commit c87aa8e

Browse files
Move matches return type method
1 parent 4658688 commit c87aa8e

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/librustc_typeck/check/method/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
383383
.find(|m| m.name() == item_name)
384384
}
385385

386-
fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>,
386+
pub fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>,
387387
expected: ty::Ty<'tcx>) -> bool {
388388
match *method {
389389
ty::ImplOrTraitItem::MethodTraitItem(ref x) => {

src/librustc_typeck/check/method/probe.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -636,16 +636,6 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
636636
Ok(())
637637
}
638638

639-
fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>,
640-
expected: &ty::Ty<'tcx>) -> bool {
641-
match *method {
642-
ty::ImplOrTraitItem::MethodTraitItem(ref x) => {
643-
self.can_sub_types(x.fty.sig.skip_binder().output, expected).is_ok()
644-
}
645-
_ => false,
646-
}
647-
}
648-
649639
fn assemble_extension_candidates_for_trait(&mut self,
650640
trait_def_id: DefId)
651641
-> Result<(), MethodError<'tcx>> {
@@ -662,7 +652,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
662652
LookingFor::ReturnType(item_ty) => {
663653
trait_items.iter()
664654
.find(|item| {
665-
self.matches_return_type(item, &item_ty)
655+
self.fcx.matches_return_type(item, &item_ty)
666656
})
667657
}
668658
};

0 commit comments

Comments
 (0)