File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
library/std/src/sys/pal/windows Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ use crate::thread;
66/// Reserve stack space for use in stack overflow exceptions.
77pub unsafe fn reserve_stack ( ) {
88 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.
911 debug_assert_ne ! ( result, 0 , "failed to reserve stack space for exception handling" ) ;
1012}
1113
@@ -26,6 +28,8 @@ unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POIN
2628
2729pub unsafe fn init ( ) {
2830 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.
2933 debug_assert ! ( !result. is_null( ) , "failed to install exception handler" ) ;
3034 // Set the thread stack guarantee for the main thread.
3135 reserve_stack ( ) ;
You can’t perform that action at this time.
0 commit comments