Update test to not trigger stack overflow

This commit is contained in:
Bryan Garza 2023-02-01 21:09:24 +00:00
parent cb6de47d3b
commit 776918971d

View File

@ -1,19 +1,16 @@
// edition: 2021
// run-pass
async fn test(_arg: [u8; 8192]) {}
async fn test(_arg: [u8; 16]) {}
async fn use_future(fut: impl std::future::Future<Output = ()>) {
fut.await
}
fn main() {
let actual = std::mem::size_of_val(&use_future(use_future(use_future(use_future(use_future(
use_future(use_future(use_future(use_future(use_future(test(
[0; 8192]
))))))
))))));
// Not putting an exact number in case it slightly changes over different commits
let expected = 8000000;
let actual = std::mem::size_of_val(
&use_future(use_future(use_future(use_future(use_future(test([0; 16])))))));
// Not using an exact number in case it slightly changes over different commits
let expected = 550;
assert!(actual > expected, "expected: >{expected}, actual: {actual}");
}