@@ -33,40 +33,14 @@ pub fn dumb_print(args: fmt::Arguments) {
3333 let _ = Stderr :: new ( ) . map ( |mut stderr| stderr. write_fmt ( args) ) ;
3434}
3535
36- // On Unix-like platforms, libc::abort will unregister signal handlers
37- // including the SIGABRT handler, preventing the abort from being blocked, and
38- // fclose streams, with the side effect of flushing them so libc bufferred
39- // output will be printed. Additionally the shell will generally print a more
40- // understandable error message like "Abort trap" rather than "Illegal
41- // instruction" that intrinsics::abort would cause, as intrinsics::abort is
42- // implemented as an illegal instruction.
43- #[ cfg( unix) ]
44- unsafe fn abort_internal ( ) -> ! {
45- :: libc:: abort ( )
46- }
47-
48- // On Windows, use the processor-specific __fastfail mechanism. In Windows 8
49- // and later, this will terminate the process immediately without running any
50- // in-process exception handlers. In earlier versions of Windows, this
51- // sequence of instructions will be treated as an access violation,
52- // terminating the process but without necessarily bypassing all exception
53- // handlers.
54- //
55- // https://msdn.microsoft.com/en-us/library/dn774154.aspx
56- #[ cfg( all( windows, any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
57- unsafe fn abort_internal ( ) -> ! {
58- asm ! ( "int $$0x29" :: "{ecx}" ( 7 ) :: : volatile) ; // 7 is FAST_FAIL_FATAL_APP_EXIT
59- :: intrinsics:: unreachable ( ) ;
60- }
61-
6236// Other platforms should use the appropriate platform-specific mechanism for
6337// aborting the process. If no platform-specific mechanism is available,
6438// ::intrinsics::abort() may be used instead. The above implementations cover
6539// all targets currently supported by libstd.
6640
6741pub fn abort ( args : fmt:: Arguments ) -> ! {
6842 dumb_print ( format_args ! ( "fatal runtime error: {}\n " , args) ) ;
69- unsafe { abort_internal ( ) ; }
43+ unsafe { :: sys :: abort_internal ( ) ; }
7044}
7145
7246#[ allow( dead_code) ] // stack overflow detection not enabled on all platforms
0 commit comments