File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 1+ // Regression test for issue #118040.
2+ // Ensure that we support assoc const eq bounds where the assoc const comes from a supertrait.
3+
4+ // check-pass
5+
6+ #![ feature( associated_const_equality) ]
7+
8+ trait Trait : SuperTrait { }
9+ trait SuperTrait : SuperSuperTrait < i32 > { }
10+ trait SuperSuperTrait < T > {
11+ const K : T ;
12+ }
13+
14+ fn take ( _: impl Trait < K = 0 > ) { }
15+
16+ fn main ( ) { }
Original file line number Diff line number Diff line change 11// Regression test for issue #112560.
22// Respect the fact that (associated) types and constants live in different namespaces and
33// therefore equality bounds involving identically named associated items don't conflict if
4- // their kind (type vs. const) differs.
5-
6- // FIXME(fmease): Extend this test to cover supertraits again
7- // once #118040 is fixed. See initial version of PR #118360.
4+ // their kind (type vs. const) differs. This obviously extends to supertraits.
85
96// check-pass
107
118#![ feature( associated_const_equality) ]
129
13- trait Trait {
10+ trait Trait : SuperTrait {
1411 type N ;
12+ type Q ;
1513
1614 const N : usize ;
1715}
1816
19- fn take ( _: impl Trait < N = 0 , N = ( ) > ) { }
17+ trait SuperTrait {
18+ const Q : & ' static str ;
19+ }
20+
21+ fn take0 ( _: impl Trait < N = 0 , N = ( ) > ) { }
22+
23+ fn take1 ( _: impl Trait < Q = "..." , Q = [ ( ) ] > ) { }
2024
2125fn main ( ) { }
Original file line number Diff line number Diff line change 66trait Owner {
77 const C <const N : u32 >: u32 ;
88 const K <const N : u32 >: u32 ;
9+ const Q <T >: Option <T >;
910}
1011
1112impl Owner for ( ) {
1213 const C <const N : u32 >: u32 = N ;
1314 const K <const N : u32 >: u32 = N + 1 ;
15+ const Q <T >: Option <T > = None ;
1416}
1517
1618fn take0 < const N : u32 > ( _: impl Owner < C < N > = { N } > ) { }
1719fn take1 ( _: impl Owner < K < 99 > = 100 > ) { }
20+ fn take2 ( _: impl Owner < Q < ( ) > = { Some ( ( ) ) } > ) { }
1821
1922fn main ( ) {
2023 take0 :: < 128 > ( ( ) ) ;
You can’t perform that action at this time.
0 commit comments