File tree Expand file tree Collapse file tree 2 files changed +24
-14
lines changed Expand file tree Collapse file tree 2 files changed +24
-14
lines changed Original file line number Diff line number Diff line change 1
1
error[E0433]: failed to resolve: there are too many leading `super` keywords
2
- --> $DIR/super-at-top-level .rs:1 :5
2
+ --> $DIR/super-at-crate-root .rs:6 :5
3
3
|
4
4
LL | use super::f;
5
5
| ^^^^^ there are too many leading `super` keywords
Original file line number Diff line number Diff line change 4
4
5
5
//@ run-pass
6
6
7
- fn f ( x : isize , cont : fn ( isize ) ) {
8
- if x == 0 {
9
- cont ( 0 ) ;
10
- } else {
11
- g ( x - 1 , |y| cont ( y + 1 ) ) ;
12
- }
7
+ fn checktrue ( rs : bool ) -> bool {
8
+ assert ! ( rs) ;
9
+ return true ;
10
+ }
11
+
12
+ pub fn main ( ) {
13
+ let k = checktrue;
14
+ evenk ( 42 , k) ;
15
+ oddk ( 45 , k) ;
13
16
}
14
17
15
- fn g ( x : isize , cont : fn ( isize ) ) {
16
- if x == 0 {
17
- cont ( 0 ) ;
18
+ fn evenk ( n : isize , k : fn ( bool ) -> bool ) -> bool {
19
+ println ! ( "evenk" ) ;
20
+ println ! ( "{}" , n) ;
21
+ if n == 0 {
22
+ return k ( true ) ;
18
23
} else {
19
- f ( x - 1 , |y| cont ( y + 1 ) ) ;
24
+ return oddk ( n - 1 , k ) ;
20
25
}
21
26
}
22
27
23
- pub fn main ( ) {
24
- f ( 100000 , |_x| { } ) ; // Test deep recursion
25
- g ( 100000 , |_x| { } ) ; // Test deep recursion
28
+ fn oddk ( n : isize , k : fn ( bool ) -> bool ) -> bool {
29
+ println ! ( "oddk" ) ;
30
+ println ! ( "{}" , n) ;
31
+ if n == 0 {
32
+ return k ( false ) ;
33
+ } else {
34
+ return evenk ( n - 1 , k) ;
35
+ }
26
36
}
You can’t perform that action at this time.
0 commit comments