File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
src/test/ui/const-generics Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ // edition:2018
2
+ #![ cfg_attr( full, feature( const_generics) ) ]
3
+ #![ cfg_attr( full, allow( incomplete_features) ) ]
4
+ #![ cfg_attr( min, feature( min_const_generics) ) ]
5
+
6
+ pub trait Foo < const N : usize > { }
7
+ struct Local ;
8
+ impl < const N : usize > Foo < N > for Local { }
9
+
10
+ pub fn out_foo < const N : usize > ( ) -> impl Foo < N > { Local }
11
+ pub fn in_foo < const N : usize > ( _: impl Foo < N > ) { }
12
+
13
+ pub async fn async_simple < const N : usize > ( _: [ u8 ; N ] ) { }
14
+ pub async fn async_out_foo < const N : usize > ( ) -> impl Foo < N > { Local }
15
+ pub async fn async_in_foo < const N : usize > ( _: impl Foo < N > ) { }
16
+
17
+ pub trait Bar < const N : usize > {
18
+ type Assoc : Foo < N > ;
19
+ }
Original file line number Diff line number Diff line change
1
+ // aux-build:crayte.rs
2
+ // edition:2018
3
+ // run-pass
4
+ // revisions: full min
5
+
6
+ #![ cfg_attr( full, feature( const_generics) ) ]
7
+ #![ cfg_attr( full, allow( incomplete_features) ) ]
8
+ #![ cfg_attr( min, feature( min_const_generics) ) ]
9
+ extern crate crayte;
10
+
11
+ use crayte:: * ;
12
+
13
+ async fn foo ( ) {
14
+ in_foo ( out_foo :: < 3 > ( ) ) ;
15
+ async_simple ( [ 0 ; 17 ] ) . await ;
16
+ async_in_foo ( async_out_foo :: < 4 > ( ) . await ) . await ;
17
+ }
18
+
19
+ struct Faz < const N : usize > ;
20
+
21
+ impl < const N : usize > Foo < N > for Faz < N > { }
22
+ impl < const N : usize > Bar < N > for Faz < N > {
23
+ type Assoc = Faz < N > ;
24
+ }
25
+
26
+ fn main ( ) {
27
+ let _ = foo;
28
+ }
You can’t perform that action at this time.
0 commit comments