This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ fn run < ' a , A > ( x : A )
2
+ where
3
+ A : ' static ,
4
+ & ' static A : ,
5
+ {
6
+ let _: & ' a A = & x;
7
+ }
8
+
9
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ trait Trait { type Resources : Resources ; }
2
+ impl Trait for ( ) {
3
+ type Resources = usize ;
4
+ }
5
+
6
+
7
+ trait ResourceFamily < ' a > { type Output ; }
8
+
9
+ struct UsizeResourceFamily ;
10
+ impl < ' a > ResourceFamily < ' a > for UsizeResourceFamily {
11
+ type Output = & ' a usize ;
12
+ }
13
+
14
+ trait Resources { type Family : for < ' a > ResourceFamily < ' a > ; }
15
+ impl Resources for usize {
16
+ type Family = UsizeResourceFamily ;
17
+ }
18
+
19
+ fn test < T : Trait > ( ) {
20
+ let _: Box < dyn Fn ( & mut <<<T as Trait >:: Resources as Resources >:: Family as ResourceFamily >:: Output ) > = Box :: new ( |_| { } ) ;
21
+ }
22
+
23
+ fn main ( ) {
24
+ test :: < ( ) > ( ) ;
25
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ #![ feature( const_fn) ]
3
+
4
+ pub struct S ( u8 ) ;
5
+
6
+ impl S {
7
+ pub fn get < const A : u8 > ( & self ) -> & u8 {
8
+ & self . 0
9
+ }
10
+ }
11
+
12
+ fn main ( ) {
13
+ const A : u8 = 5 ;
14
+ let s = S ( 0 ) ;
15
+
16
+ s. get :: < A > ( ) ;
17
+ }
You can’t perform that action at this time.
0 commit comments