-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from iosis-tech/fix/swiftness_air/stack
swiftness_air stack size guard
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
fn main() { | ||
if cfg!(feature = "dynamic") { | ||
/* | ||
MIN_STACK_SIZE: | ||
8 MB: 8388608 | ||
16 MB: 16777216 | ||
32 MB: 33554432 | ||
64 MB: 67108864 | ||
*/ | ||
const MIN_STACK_SIZE: usize = 16_777_216; | ||
println!("cargo:rerun-if-env-changed=RUST_MIN_STACK"); | ||
|
||
let rust_min_stack: usize = std::env::var("RUST_MIN_STACK") | ||
.expect("Environment variable RUST_MIN_STACK must be set. Set it to at least 16777216.") | ||
.parse() | ||
.expect("RUST_MIN_STACK must be a valid integer."); | ||
|
||
if rust_min_stack < MIN_STACK_SIZE { | ||
panic!( | ||
"RUST_MIN_STACK must be at least {}. Current value: {}.", | ||
MIN_STACK_SIZE, rust_min_stack | ||
); | ||
} | ||
} | ||
} |