1
Fork 0

Add a simpler and more targetted code path for impl trait in assoc items

This commit is contained in:
Oli Scherer 2024-01-09 11:12:30 +00:00
parent 366d112fa6
commit f58af9ba28
4 changed files with 88 additions and 8 deletions

View file

@ -272,6 +272,13 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
}
}
fn impl_trait_in_assoc_types_defined_by<'tcx>(
tcx: TyCtxt<'tcx>,
item: LocalDefId,
) -> &'tcx ty::List<LocalDefId> {
opaque_types_defined_by(tcx, item)
}
fn opaque_types_defined_by<'tcx>(
tcx: TyCtxt<'tcx>,
item: LocalDefId,
@ -321,5 +328,6 @@ fn opaque_types_defined_by<'tcx>(
}
pub(super) fn provide(providers: &mut Providers) {
*providers = Providers { opaque_types_defined_by, ..*providers };
*providers =
Providers { opaque_types_defined_by, impl_trait_in_assoc_types_defined_by, ..*providers };
}