This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree 4 files changed +103
-0
lines changed
4 files changed +103
-0
lines changed Original file line number Diff line number Diff line change
1
+ pub struct DirEnts < ' a > {
2
+ pub cluster : :: std:: marker:: PhantomData < & ' a ( ) > ,
3
+ }
4
+ impl < ' a > DirEnts < ' a > {
5
+ pub fn next ( & mut self ) -> [ u8 ; 12 ] {
6
+ // NOTE: Tuple destructure needed
7
+ // NOTE: Arithmatic needed
8
+ let ( outname, ) = ( [ 0u8 ; 12 + 0 ] , ) ;
9
+ outname
10
+ }
11
+ }
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ #![ allow( incomplete_features) ]
3
+
4
+ struct Foo {
5
+ i : i32 ,
6
+ }
7
+
8
+ trait Get < ' a , const N : & ' static str > {
9
+ type Target : ' a ;
10
+
11
+ fn get ( & ' a self ) -> & ' a Self :: Target ;
12
+ }
13
+
14
+ impl Foo {
15
+ fn ask < ' a , const N : & ' static str > ( & ' a self ) -> & ' a <Self as Get < N > >:: Target
16
+ where
17
+ Self : Get < ' a , N > ,
18
+ {
19
+ self . get ( )
20
+ }
21
+ }
22
+
23
+ impl < ' a > Get < ' a , "int" > for Foo {
24
+ type Target = i32 ;
25
+
26
+ fn get ( & ' a self ) -> & ' a Self :: Target {
27
+ & self . i
28
+ }
29
+ }
30
+
31
+ fn main ( ) {
32
+ let foo = Foo { i : 123 } ;
33
+
34
+ //println!("{}", foo.ask()); // okay
35
+ println ! ( "{}" , foo. ask:: <"int" >( ) ) ; // ICE
36
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics, const_compare_raw_pointers) ]
2
+ #![ allow( incomplete_features) ]
3
+
4
+ struct Test ( * const usize ) ;
5
+
6
+ type PassArg = ( ) ;
7
+
8
+ unsafe extern "C" fn pass ( args : PassArg ) {
9
+ ( )
10
+ }
11
+
12
+ impl Test {
13
+ pub fn call_me < Args : Sized , const IDX : usize , const FN : unsafe extern "C" fn ( Args ) > ( & self ) {
14
+ self . 0 = Self :: trampiline :: < Args , IDX , FN > as _
15
+ }
16
+
17
+ unsafe extern "C" fn trampiline <
18
+ Args : Sized ,
19
+ const IDX : usize ,
20
+ const FN : unsafe extern "C" fn ( Args ) ,
21
+ > (
22
+ args : Args ,
23
+ ) {
24
+ FN ( args)
25
+ }
26
+ }
27
+
28
+ fn main ( ) {
29
+ let x = Test ( ) ;
30
+ x. call_me :: < PassArg , 30 , pass > ( )
31
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics, const_compare_raw_pointers) ]
2
+ #![ allow( incomplete_features) ]
3
+
4
+ struct Test ( ) ;
5
+
6
+ fn pass ( ) {
7
+ ( )
8
+ }
9
+
10
+ impl Test {
11
+ pub fn call_me ( & self ) {
12
+ self . test :: < pass > ( ) ;
13
+ }
14
+
15
+ fn test < const FN : fn ( ) > ( & self ) {
16
+ FN ( ) ;
17
+ }
18
+ }
19
+
20
+ fn main ( ) {
21
+ let x = Test ( ) ;
22
+ x. call_me ( )
23
+ }
You can’t perform that action at this time.
0 commit comments