Properly skip RPITITs from ModChild and give a name in AssocItem

This commit is contained in:
Santiago Pastorino 2023-03-27 18:33:04 -03:00
parent 76b0cf812b
commit 66714658d0
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
3 changed files with 10 additions and 9 deletions

View File

@ -404,12 +404,8 @@ impl DefPathData {
match *self {
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
// We use this name when collecting `ModChild`s.
// FIXME this could probably be removed with some refactoring to the name resolver.
ImplTraitAssocTy => Some(kw::Empty),
Impl | ForeignMod | CrateRoot | Use | GlobalAsm | ClosureExpr | Ctor | AnonConst
| ImplTrait => None,
| ImplTrait | ImplTraitAssocTy => None,
}
}

View File

@ -1021,7 +1021,9 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
} else {
// Iterate over all children.
for child_index in self.root.tables.children.get(self, id).unwrap().decode(self) {
yield self.get_mod_child(child_index, sess);
if self.root.tables.opt_rpitit_info.get(self, child_index).is_none() {
yield self.get_mod_child(child_index, sess);
}
}
if let Some(reexports) = self.root.tables.module_reexports.get(self, id) {
@ -1067,8 +1069,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}
fn get_associated_item(self, id: DefIndex, sess: &'a Session) -> ty::AssocItem {
let name = self.item_name(id);
let name = if self.root.tables.opt_rpitit_info.get(self, id).is_some() {
kw::Empty
} else {
self.item_name(id)
};
let (kind, has_self) = match self.def_kind(id) {
DefKind::AssocConst => (ty::AssocKind::Const, false),
DefKind::AssocFn => (ty::AssocKind::Fn, self.get_fn_has_self_parameter(id, sess)),

View File

@ -10,7 +10,7 @@ note: required by a bound in `Foo::{opaque#0}`
--> $DIR/doesnt-satisfy.rs:8:22
|
LL | fn bar() -> impl std::fmt::Display;
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::`
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
error: aborting due to previous error