Skip to content

Commit 88e9430

Browse files
nikomatsakisGuillaumeGomez
authored andcommitted
call impl_or_trait_item() instead instead of associated_item()
The older method was not aware of the return type possibility.
1 parent 044b07d commit 88e9430

File tree

1 file changed

+3
-11
lines changed
  • src/librustc_typeck/check/method

1 file changed

+3
-11
lines changed

src/librustc_typeck/check/method/probe.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
468468

469469
debug!("assemble_inherent_impl_probe {:?}", impl_def_id);
470470

471-
let item = match self.associated_item(impl_def_id) {
471+
let item = match self.impl_or_trait_item(impl_def_id) {
472472
Some(m) => m,
473473
None => {
474474
return;
@@ -598,7 +598,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
598598

599599
let tcx = self.tcx;
600600
for bound_trait_ref in traits::transitive_bounds(tcx, bounds) {
601-
let item = match self.associated_item(bound_trait_ref.def_id()) {
601+
let item = match self.impl_or_trait_item(bound_trait_ref.def_id()) {
602602
Some(v) => v,
603603
None => {
604604
continue;
@@ -1350,15 +1350,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
13501350
self.tcx.erase_late_bound_regions(value)
13511351
}
13521352

1353-
/// Find item with name `item_name` defined in impl/trait `def_id`
1354-
/// and return it, or `None`, if no such item was defined there.
1355-
fn associated_item(&self, def_id: DefId) -> Option<ty::AssociatedItem> {
1356-
match self.looking_for {
1357-
LookingFor::MethodName(item_name) => self.fcx.associated_item(def_id, item_name),
1358-
_ => None,
1359-
}
1360-
}
1361-
1353+
/// Find the method with the appropriate name (or return type, as the case may be).
13621354
fn impl_or_trait_item(&self, def_id: DefId) -> Option<ty::AssociatedItem> {
13631355
match self.looking_for {
13641356
LookingFor::MethodName(name) => {

0 commit comments

Comments
 (0)