about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/check
diff options
context:
space:
mode:
authorbohan <bohan-zhang@foxmail.com>2025-07-13 02:52:03 +0800
committerbohan <bohan-zhang@foxmail.com>2025-07-13 02:52:13 +0800
commit47e15d90e13b5238117971298a3573ddebd87a40 (patch)
treea87477f39fa2912da6a28b2f1a13f6f0f6a77af2 /compiler/rustc_hir_analysis/src/check
parentdc6c3300fcf520b2931355e922caa66758becb71 (diff)
downloadrust-47e15d90e13b5238117971298a3573ddebd87a40.tar.gz
rust-47e15d90e13b5238117971298a3573ddebd87a40.zip
query RPITIT in a trait or impl
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check')
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs6
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs6
2 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index 87db80f2423..379ce69bdea 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -15,6 +15,7 @@ use rustc_middle::ty::error::{ExpectedFound, TypeError};
 use rustc_middle::ty::{
     self, BottomUpFolder, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeFoldable, TypeFolder,
     TypeSuperFoldable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode, Upcast,
+    associated_types_for_impl_traits_in_associated_fn,
 };
 use rustc_middle::{bug, span_bug};
 use rustc_span::{DUMMY_SP, Span};
@@ -757,7 +758,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
     // returning `-> Missing<impl Sized>`, that gets converted to `-> {type error}`,
     // and when walking through the signature we end up never collecting the def id
     // of the `impl Sized`. Insert that here, so we don't ICE later.
-    for assoc_item in tcx.associated_types_for_impl_traits_in_associated_fn(trait_m.def_id) {
+    for assoc_item in associated_types_for_impl_traits_in_associated_fn(tcx, trait_m.def_id) {
         if !remapped_types.contains_key(assoc_item) {
             remapped_types.insert(
                 *assoc_item,
@@ -2448,8 +2449,7 @@ fn param_env_with_gat_bounds<'tcx>(
                     ty::ImplTraitInTraitData::Impl { fn_def_id }
                     | ty::ImplTraitInTraitData::Trait { fn_def_id, .. },
                 ),
-        } => tcx
-            .associated_types_for_impl_traits_in_associated_fn(fn_def_id)
+        } => associated_types_for_impl_traits_in_associated_fn(tcx, fn_def_id)
             .iter()
             .map(|def_id| tcx.associated_item(*def_id))
             .collect(),
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index 428d627ad6f..3d3fdd899d3 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -20,7 +20,7 @@ use rustc_middle::ty::trait_def::TraitSpecializationKind;
 use rustc_middle::ty::{
     self, AdtKind, GenericArgKind, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeFlags,
     TypeFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode,
-    Upcast,
+    Upcast, associated_types_for_impl_traits_in_associated_fn,
 };
 use rustc_middle::{bug, span_bug};
 use rustc_session::parse::feature_err;
@@ -326,7 +326,9 @@ pub(crate) fn check_trait_item<'tcx>(
     let mut res = Ok(());
 
     if matches!(tcx.def_kind(def_id), DefKind::AssocFn) {
-        for &assoc_ty_def_id in tcx.associated_types_for_impl_traits_in_associated_fn(def_id) {
+        for &assoc_ty_def_id in
+            associated_types_for_impl_traits_in_associated_fn(tcx, def_id.to_def_id())
+        {
             res = res.and(check_associated_item(tcx, assoc_ty_def_id.expect_local()));
         }
     }