query RPITIT in a trait or impl
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user