File tree 3 files changed +60
-0
lines changed
3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ rustc -Zmir-opt-level=3 --emit=mir - << EOF
4
+
5
+ pub trait Associate {
6
+ type Associated;
7
+ }
8
+
9
+ pub struct Wrap<'a> {
10
+ pub field: &'a i32,
11
+ }
12
+
13
+ pub trait Create<T> {
14
+ fn create() -> Self;
15
+ }
16
+
17
+ pub fn oh_no<'a, T>()
18
+ where
19
+ Wrap<'a>: Associate,
20
+ <Wrap<'a> as Associate>::Associated: Create<T>,
21
+ {
22
+ <Wrap<'a> as Associate>::Associated::create();
23
+ }
24
+
25
+ pub fn main() {}
26
+
27
+ EOF
Original file line number Diff line number Diff line change
1
+ use std:: ffi:: CString ;
2
+
3
+ impl Lock {
4
+ pub fn new ( ) {
5
+ if ( ) == -1 {
6
+ CString :: new ( ) ;
7
+ }
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ pub fn compose (
2
+ f1 : impl FnOnce ( f64 ) -> f64 + Clone ,
3
+ f2 : impl FnOnce ( f64 ) -> f64 + Clone ,
4
+ ) -> impl FnOnce ( f64 ) -> f64 + Clone {
5
+ move |x| f1 ( f2 ( x) )
6
+ }
7
+
8
+ pub fn double ( f : impl FnOnce ( f64 ) -> f64 + Clone ) -> impl FnOnce ( f64 ) -> f64 + Clone {
9
+ compose ( f. clone ( ) , f)
10
+ }
11
+
12
+
13
+ fn repeat_helper ( f : impl FnOnce ( f64 ) -> f64 + Clone , res : impl FnOnce ( f64 ) -> f64 + Clone , times : usize ) -> impl FnOnce ( f64 ) -> f64 + Clone {
14
+ if times == 1 {
15
+ return res;
16
+ }
17
+ repeat_helper ( f. clone ( ) , compose ( f, res) , times - 1 )
18
+ }
19
+
20
+ pub fn repeat ( f : impl FnOnce ( f64 ) -> f64 + Clone , times : usize ) -> impl FnOnce ( f64 ) -> f64 + Clone {
21
+ repeat_helper ( f. clone ( ) , f, times)
22
+ }
23
+
24
+ pub fn main ( ) { }
You can’t perform that action at this time.
0 commit comments