Do not require associated types with Self: Sized to uphold bounds when confirming object candidate
This commit is contained in:
parent
7a6b52bf0d
commit
07fc644132
7 changed files with 54 additions and 28 deletions
|
@ -354,9 +354,9 @@ pub(in crate::solve) fn predicates_for_object_candidate<'tcx>(
|
|||
// FIXME(associated_const_equality): Also add associated consts to
|
||||
// the requirements here.
|
||||
if item.kind == ty::AssocKind::Type {
|
||||
// RPITITs are not checked here, since they are not (currently) object-safe
|
||||
// and cannot be named from a non-`Self: Sized` method.
|
||||
if item.is_impl_trait_in_trait() {
|
||||
// associated types that require `Self: Sized` do not show up in the built-in
|
||||
// implementation of `Trait for dyn Trait`, and can be dropped here.
|
||||
if tcx.generics_require_sized_self(item.def_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -535,9 +535,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let assoc_types: Vec<_> = tcx
|
||||
.associated_items(trait_predicate.def_id())
|
||||
.in_definition_order()
|
||||
// RPITITs are not checked here, since they are not (currently) object-safe
|
||||
// and cannot be named from a non-`Self: Sized` method.
|
||||
.filter(|item| !item.is_impl_trait_in_trait())
|
||||
// Associated types that require `Self: Sized` do not show up in the built-in
|
||||
// implementation of `Trait for dyn Trait`, and can be dropped here.
|
||||
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
|
||||
.filter_map(
|
||||
|item| if item.kind == ty::AssocKind::Type { Some(item.def_id) } else { None },
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue