Rollup merge of #140278 - compiler-errors:name-based-comparison, r=nnethercote
Don't use item name to look up associated item from trait item This fix should be self-justifying b/c the fact that we were using identifiers here was kinda sus anyways, esp b/c we have a failproof way of doing the comparison :) I'll leave some info about why this repro needs a macro. Fixes https://github.com/rust-lang/rust/issues/140259 r? `@nnethercote`
This commit is contained in:
@@ -1523,19 +1523,17 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
return None;
|
||||
};
|
||||
|
||||
let trait_assoc_item = self.tcx.opt_associated_item(proj.projection_term.def_id)?;
|
||||
let trait_assoc_ident = trait_assoc_item.ident(self.tcx);
|
||||
|
||||
let mut associated_items = vec![];
|
||||
self.tcx.for_each_relevant_impl(
|
||||
self.tcx.trait_of_item(proj.projection_term.def_id)?,
|
||||
proj.projection_term.self_ty(),
|
||||
|impl_def_id| {
|
||||
associated_items.extend(
|
||||
self.tcx
|
||||
.associated_items(impl_def_id)
|
||||
.in_definition_order()
|
||||
.find(|assoc| assoc.ident(self.tcx) == trait_assoc_ident),
|
||||
self.tcx.associated_items(impl_def_id).in_definition_order().find(
|
||||
|assoc| {
|
||||
assoc.trait_item_def_id == Some(proj.projection_term.def_id)
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user