File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/test/ui/const-generics Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ // edition:2018
2+ // check-pass
3+ // revisions: full min
4+ #![ cfg_attr( full, feature( const_generics) ) ]
5+ #![ cfg_attr( full, allow( incomplete_features) ) ]
6+ #![ cfg_attr( min, feature( min_const_generics) ) ]
7+
8+ async fn foo < const N : usize > ( arg : [ u8 ; N ] ) -> usize { arg. len ( ) }
9+
10+ async fn bar < const N : usize > ( ) -> [ u8 ; N ] {
11+ [ 0 ; N ]
12+ }
13+
14+ trait Trait < const N : usize > {
15+ fn fynn ( & self ) -> usize ;
16+ }
17+ impl < const N : usize > Trait < N > for [ u8 ; N ] {
18+ fn fynn ( & self ) -> usize {
19+ N
20+ }
21+ }
22+ async fn baz < const N : usize > ( ) -> impl Trait < N > {
23+ [ 0 ; N ]
24+ }
25+
26+ async fn biz < const N : usize > ( v : impl Trait < N > ) -> usize {
27+ v. fynn ( )
28+ }
29+
30+ async fn user < const N : usize > ( ) {
31+ let _ = foo :: < N > ( bar ( ) . await ) . await ;
32+ let _ = biz ( baz :: < N > ( ) . await ) . await ;
33+ }
34+
35+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments