File tree 1 file changed +4
-0
lines changed
library/std/src/sys/pal/windows
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ use crate::thread;
6
6
/// Reserve stack space for use in stack overflow exceptions.
7
7
pub unsafe fn reserve_stack ( ) {
8
8
let result = c:: SetThreadStackGuarantee ( & mut 0x5000 ) ;
9
+ // Reserving stack space is not critical so we allow it to fail in the released build of libstd.
10
+ // We still use debug assert here so that CI will test that we haven't made a mistake calling the function.
9
11
debug_assert_ne ! ( result, 0 , "failed to reserve stack space for exception handling" ) ;
10
12
}
11
13
@@ -26,6 +28,8 @@ unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POIN
26
28
27
29
pub unsafe fn init ( ) {
28
30
let result = c:: AddVectoredExceptionHandler ( 0 , Some ( vectored_handler) ) ;
31
+ // Similar to the above, adding the stack overflow handler is allowed to fail
32
+ // but a debug assert is used so CI will still test that it normally works.
29
33
debug_assert ! ( !result. is_null( ) , "failed to install exception handler" ) ;
30
34
// Set the thread stack guarantee for the main thread.
31
35
reserve_stack ( ) ;
You can’t perform that action at this time.
0 commit comments