Move matches return type method

This commit is contained in:
Guillaume Gomez 2016-10-27 20:53:03 +02:00
parent 07a3ede5f2
commit 8057d485d4
2 changed files with 2 additions and 12 deletions

View File

@ -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) => {

View File

@ -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)
})
}
};