Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ fn predicates_reference_self(
fn bounds_reference_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span; 1]> {
tcx.associated_items(trait_def_id)
.in_definition_order()
// We're only looking at associated type bounds
.filter(|item| item.kind == ty::AssocKind::Type)
// Ignore GATs with `Self: Sized`
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
.flat_map(|item| tcx.explicit_item_bounds(item.def_id).iter_identity_copied())
.filter_map(|(clause, sp)| {
// Item bounds *can* have self projections, since they never get
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Ensure that we properly ignore the `B<Self>` associated type bound on `A::T`
// since that associated type requires `Self: Sized`.

//@ check-pass

struct X(&'static dyn A);

trait A {
type T: B<Self> where Self: Sized;
}

trait B<T> {}

fn main() {}
Loading