File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
tests/ui/associated-inherent-types Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ // Regression test for issue #109759.
2+ // check-pass
3+
4+ #![ feature( inherent_associated_types) ]
5+ #![ allow( incomplete_features) ]
6+
7+ struct Foo ;
8+
9+ struct Bar < const X : usize > ( [ ( ) ; X ] ) ;
10+
11+ impl < const X : usize > Bar < X > {
12+ pub fn new ( ) -> Self {
13+ Self ( [ ( ) ; X ] )
14+ }
15+ }
16+
17+ impl Foo {
18+ type Bar < const X : usize > = Bar < X > ;
19+ }
20+
21+ fn main ( ) {
22+ let _ = Foo :: Bar :: < 10 > :: new ( ) ;
23+ }
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ feature( inherent_associated_types, generic_const_exprs) ]
4+ #![ allow( incomplete_features) ]
5+
6+ struct Parent < const O : usize > ;
7+
8+ impl < const O : usize > Parent < O > {
9+ type Mapping < const I : usize > = Store < { O + I } >
10+ where
11+ [ ( ) ; O + I ] :
12+ ;
13+ }
14+
15+ struct Store < const N : usize > ;
16+
17+ impl < const N : usize > Store < N > {
18+ const REIFIED : usize = N ;
19+
20+ fn reify ( ) -> usize {
21+ N
22+ }
23+ }
24+
25+ fn main ( ) {
26+ let _ = Parent :: < 2 > :: Mapping :: < { 12 * 2 } > :: REIFIED ;
27+ let _ = Parent :: < 1 > :: Mapping :: < { 2 * 5 } > :: reify ( ) ;
28+ }
You can’t perform that action at this time.
0 commit comments