This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
compiler/rustc_trait_selection/src/traits
tests/ui/dyn-compatibility Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,10 @@ fn predicates_reference_self(
187
187
fn bounds_reference_self ( tcx : TyCtxt < ' _ > , trait_def_id : DefId ) -> SmallVec < [ Span ; 1 ] > {
188
188
tcx. associated_items ( trait_def_id)
189
189
. in_definition_order ( )
190
+ // We're only looking at associated type bounds
190
191
. filter ( |item| item. kind == ty:: AssocKind :: Type )
192
+ // Ignore GATs with `Self: Sized`
193
+ . filter ( |item| !tcx. generics_require_sized_self ( item. def_id ) )
191
194
. flat_map ( |item| tcx. explicit_item_bounds ( item. def_id ) . iter_identity_copied ( ) )
192
195
. filter_map ( |( clause, sp) | {
193
196
// Item bounds *can* have self projections, since they never get
Original file line number Diff line number Diff line change
1
+ // Ensure that we properly ignore the `B<Self>` associated type bound on `A::T`
2
+ // since that associated type requires `Self: Sized`.
3
+
4
+ //@ check-pass
5
+
6
+ struct X ( & ' static dyn A ) ;
7
+
8
+ trait A {
9
+ type T : B < Self > where Self : Sized ;
10
+ }
11
+
12
+ trait B < T > { }
13
+
14
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments