Skip to content

Commit e270920

Browse files
committed
Update stack_overflow
1 parent 411cc8c commit e270920

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

user/src/bin/stack_overflow.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
#[macro_use]
55
extern crate user_lib;
66

7-
fn f(d: usize) {
8-
println!("d = {}", d);
9-
f(d + 1);
7+
#[allow(unconditional_recursion)]
8+
fn f(depth: usize) {
9+
if depth % 10 == 0 {
10+
println!("depth = {}", depth);
11+
}
12+
f(depth + 1);
1013
}
1114

1215
#[no_mangle]

0 commit comments

Comments
 (0)