From 88e9430dbbb60f89af3c3d9a6998d293ec78c39b Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 1 Dec 2016 15:27:18 -0500 Subject: [PATCH] call `impl_or_trait_item()` instead instead of `associated_item()` The older method was not aware of the return type possibility. --- src/librustc_typeck/check/method/probe.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 04d714f269a5..d2089fb49152 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -468,7 +468,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { debug!("assemble_inherent_impl_probe {:?}", impl_def_id); - let item = match self.associated_item(impl_def_id) { + let item = match self.impl_or_trait_item(impl_def_id) { Some(m) => m, None => { return; @@ -598,7 +598,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { let tcx = self.tcx; for bound_trait_ref in traits::transitive_bounds(tcx, bounds) { - let item = match self.associated_item(bound_trait_ref.def_id()) { + let item = match self.impl_or_trait_item(bound_trait_ref.def_id()) { Some(v) => v, None => { continue; @@ -1350,15 +1350,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { self.tcx.erase_late_bound_regions(value) } - /// Find item with name `item_name` defined in impl/trait `def_id` - /// and return it, or `None`, if no such item was defined there. - fn associated_item(&self, def_id: DefId) -> Option { - match self.looking_for { - LookingFor::MethodName(item_name) => self.fcx.associated_item(def_id, item_name), - _ => None, - } - } - + /// Find the method with the appropriate name (or return type, as the case may be). fn impl_or_trait_item(&self, def_id: DefId) -> Option { match self.looking_for { LookingFor::MethodName(name) => {