Skip to content

Commit 6671465

Browse files
committed
Properly skip RPITITs from ModChild and give a name in AssocItem
1 parent 76b0cf8 commit 6671465

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

compiler/rustc_hir/src/definitions.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,8 @@ impl DefPathData {
404404
match *self {
405405
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
406406

407-
// We use this name when collecting `ModChild`s.
408-
// FIXME this could probably be removed with some refactoring to the name resolver.
409-
ImplTraitAssocTy => Some(kw::Empty),
410-
411407
Impl | ForeignMod | CrateRoot | Use | GlobalAsm | ClosureExpr | Ctor | AnonConst
412-
| ImplTrait => None,
408+
| ImplTrait | ImplTraitAssocTy => None,
413409
}
414410
}
415411

compiler/rustc_metadata/src/rmeta/decoder.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,9 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10211021
} else {
10221022
// Iterate over all children.
10231023
for child_index in self.root.tables.children.get(self, id).unwrap().decode(self) {
1024-
yield self.get_mod_child(child_index, sess);
1024+
if self.root.tables.opt_rpitit_info.get(self, child_index).is_none() {
1025+
yield self.get_mod_child(child_index, sess);
1026+
}
10251027
}
10261028

10271029
if let Some(reexports) = self.root.tables.module_reexports.get(self, id) {
@@ -1067,8 +1069,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10671069
}
10681070

10691071
fn get_associated_item(self, id: DefIndex, sess: &'a Session) -> ty::AssocItem {
1070-
let name = self.item_name(id);
1071-
1072+
let name = if self.root.tables.opt_rpitit_info.get(self, id).is_some() {
1073+
kw::Empty
1074+
} else {
1075+
self.item_name(id)
1076+
};
10721077
let (kind, has_self) = match self.def_kind(id) {
10731078
DefKind::AssocConst => (ty::AssocKind::Const, false),
10741079
DefKind::AssocFn => (ty::AssocKind::Fn, self.get_fn_has_self_parameter(id, sess)),

tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ note: required by a bound in `Foo::{opaque#0}`
1010
--> $DIR/doesnt-satisfy.rs:8:22
1111
|
1212
LL | fn bar() -> impl std::fmt::Display;
13-
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::`
13+
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
1414

1515
error: aborting due to previous error
1616

0 commit comments

Comments
 (0)