diff --git a/Cargo.toml b/Cargo.toml index ef48a05..ccb231d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stacker" -version = "0.1.20" +version = "0.1.21" edition = "2021" rust-version = "1.63" authors = ["Alex Crichton ", "Simonas Kazlauskas "] diff --git a/src/lib.rs b/src/lib.rs index ea58ee9..ee5803c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,7 +91,7 @@ pub fn grow R>(stack_size: usize, callback: F) -> R { /// to determine whether a stack switch should be made or not. pub fn remaining_stack() -> Option { let current_ptr = current_stack_ptr(); - get_stack_limit().map(|limit| current_ptr - limit) + get_stack_limit().map(|limit| current_ptr.saturating_sub(limit)) } psm_stack_information!(