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 11error[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
33 |
44LL | use super::f;
55 | ^^^^^ there are too many leading `super` keywords
Original file line number Diff line number Diff line change 44
55//@ run-pass
66
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) ;
1316}
1417
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 ) ;
1823 } else {
19- f ( x - 1 , |y| cont ( y + 1 ) ) ;
24+ return oddk ( n - 1 , k ) ;
2025 }
2126}
2227
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+ }
2636}
You can’t perform that action at this time.
0 commit comments