diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 0af32c8fe6d..334ef30487a 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -355,7 +355,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tcx.associated_items(def_id).find(|item| item.name == item_name) } - fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>, + pub fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>, expected: ty::Ty<'tcx>) -> bool { match *method { ty::ImplOrTraitItem::MethodTraitItem(ref x) => { diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 32de37764f6..85a2fcd2ba1 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -626,16 +626,6 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { Ok(()) } - fn matches_return_type(&self, method: &ty::ImplOrTraitItem<'tcx>, - expected: &ty::Ty<'tcx>) -> bool { - match *method { - ty::ImplOrTraitItem::MethodTraitItem(ref x) => { - self.can_sub_types(x.fty.sig.skip_binder().output, expected).is_ok() - } - _ => false, - } - } - fn assemble_extension_candidates_for_trait(&mut self, trait_def_id: DefId) -> Result<(), MethodError<'tcx>> { @@ -652,7 +642,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { LookingFor::ReturnType(item_ty) => { trait_items.iter() .find(|item| { - self.matches_return_type(item, &item_ty) + self.fcx.matches_return_type(item, &item_ty) }) } };