Skip to content

Commit 8057d48

Browse files
Move matches return type method
1 parent 07a3ede commit 8057d48

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
@@ -355,7 +355,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
355355
self.tcx.associated_items(def_id).find(|item| item.name == item_name)
356356
}
357357

358-
fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>,
358+
pub fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>,
359359
expected: ty::Ty<'tcx>) -> bool {
360360
match *method {
361361
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
@@ -626,16 +626,6 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
626626
Ok(())
627627
}
628628

629-
fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>,
630-
expected: &ty::Ty<'tcx>) -> bool {
631-
match *method {
632-
ty::ImplOrTraitItem::MethodTraitItem(ref x) => {
633-
self.can_sub_types(x.fty.sig.skip_binder().output, expected).is_ok()
634-
}
635-
_ => false,
636-
}
637-
}
638-
639629
fn assemble_extension_candidates_for_trait(&mut self,
640630
trait_def_id: DefId)
641631
-> Result<(), MethodError<'tcx>> {
@@ -652,7 +642,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
652642
LookingFor::ReturnType(item_ty) => {
653643
trait_items.iter()
654644
.find(|item| {
655-
self.matches_return_type(item, &item_ty)
645+
self.fcx.matches_return_type(item, &item_ty)
656646
})
657647
}
658648
};

0 commit comments

Comments
 (0)