()
| 1531 | THREAD_POOL.with_worker(|_| { |
| 1532 | let mut max_diff = Mutex::new(0); |
| 1533 | let bottom_of_stack = 0; |
| 1534 | scope(|s| the_final_countdown(s, &bottom_of_stack, &max_diff, 5)); |
| 1535 | let diff_when_5 = *max_diff.get_mut().unwrap() as f64; |
| 1536 | |
| 1537 | scope(|s| the_final_countdown(s, &bottom_of_stack, &max_diff, 500)); |
| 1538 | let diff_when_500 = *max_diff.get_mut().unwrap() as f64; |
| 1539 | |
| 1540 | let ratio = diff_when_5 / diff_when_500; |
| 1541 | assert!( |
| 1542 | ratio > 0.9 && ratio < 1.1, |
| 1543 | "stack usage ratio out of bounds: {ratio}" |
| 1544 | ); |
| 1545 | }); |
| 1546 | |
| 1547 | THREAD_POOL.depopulate(); |
| 1548 | } |
| 1549 | |
| 1550 | fn the_final_countdown<'scope, 'env>( |
| 1551 | scope: &'scope Scope<'scope, 'env>, |
| 1552 | bottom_of_stack: &'scope i32, |
| 1553 | max: &'scope Mutex<usize>, |
nothing calls this directly
no test coverage detected