@@ -27,16 +27,7 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
27
27
unreachable ! ( )
28
28
}
29
29
30
- // "Leak" the payload and shim to the relevant abort on the platform in
31
- // question.
32
- //
33
- // For Unix we just use `abort` from libc as it'll trigger debuggers, core
34
- // dumps, etc, as one might expect. On Windows, however, the best option we have
35
- // is the `__fastfail` intrinsics, but that's unfortunately not defined in LLVM,
36
- // and the `RaiseFailFastException` function isn't available until Windows 7
37
- // which would break compat with XP. For now just use `intrinsics::abort` which
38
- // will kill us with an illegal instruction, which will do a good enough job for
39
- // now hopefully.
30
+ // "Leak" the payload and shim to the relevant abort on the platform in question.
40
31
#[ rustc_std_internal_symbol]
41
32
pub unsafe extern "C" fn __rust_start_panic ( _payload : usize ) -> u32 {
42
33
abort ( ) ;
@@ -57,14 +48,16 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
57
48
__rust_abort( ) ;
58
49
}
59
50
} else if #[ cfg( all( windows, any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ] {
60
- // On Windows, use the processor-specific __fastfail mechanism. In Windows 8
51
+ // On Windows, use the processor-specific __fastfail mechanism. In Windows 8
61
52
// and later, this will terminate the process immediately without running any
62
- // in-process exception handlers. In earlier versions of Windows, this
53
+ // in-process exception handlers. In earlier versions of Windows, this
63
54
// sequence of instructions will be treated as an access violation,
64
55
// terminating the process but without necessarily bypassing all exception
65
56
// handlers.
66
57
//
67
58
// https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
59
+ //
60
+ // Note: this is the same implementation as in libstd's `abort_internal`
68
61
unsafe fn abort( ) -> ! {
69
62
llvm_asm!( "int $$0x29" :: "{ecx}" ( 7 ) :: : volatile) ; // 7 is FAST_FAIL_FATAL_APP_EXIT
70
63
core:: intrinsics:: unreachable( ) ;
0 commit comments