about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-01-09 11:12:30 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-01-22 14:35:46 +0000
commitf58af9ba28f1bb49f880da43227c65cc10673be2 (patch)
tree54c3adccca31a2126383f44d48b7f4092e7b8fbb /compiler/rustc_ty_utils/src
parent366d112fa69164d79239ceeaa49e06497df5497f (diff)
downloadrust-f58af9ba28f1bb49f880da43227c65cc10673be2.tar.gz
rust-f58af9ba28f1bb49f880da43227c65cc10673be2.zip
Add a simpler and more targetted code path for impl trait in assoc items
Diffstat (limited to 'compiler/rustc_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/opaque_types.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_ty_utils/src/opaque_types.rs b/compiler/rustc_ty_utils/src/opaque_types.rs
index 0bb833c66fa..eae4c57fc99 100644
--- a/compiler/rustc_ty_utils/src/opaque_types.rs
+++ b/compiler/rustc_ty_utils/src/opaque_types.rs
@@ -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 };
 }