File tree Expand file tree Collapse file tree 11 files changed +29
-23
lines changed Expand file tree Collapse file tree 11 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ pub fn rust_oom(layout: Layout) -> ! {
279279 let hook: fn ( Layout ) =
280280 if hook. is_null ( ) { default_alloc_error_hook } else { unsafe { mem:: transmute ( hook) } } ;
281281 hook ( layout) ;
282- unsafe { crate :: sys :: abort_internal ( ) }
282+ crate :: process :: abort ( )
283283}
284284
285285#[ cfg( not( test) ) ]
Original file line number Diff line number Diff line change @@ -1620,7 +1620,7 @@ pub fn exit(code: i32) -> ! {
16201620/// [panic hook]: ../../std/panic/fn.set_hook.html
16211621#[ stable( feature = "process_abort" , since = "1.17.0" ) ]
16221622pub fn abort ( ) -> ! {
1623- unsafe { crate :: sys:: abort_internal ( ) } ;
1623+ crate :: sys:: abort_internal ( ) ;
16241624}
16251625
16261626/// Returns the OS-assigned process identifier associated with this process.
Original file line number Diff line number Diff line change @@ -51,8 +51,11 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
5151 }
5252}
5353
54- pub unsafe fn abort_internal ( ) -> ! {
55- core:: intrinsics:: abort ( ) ;
54+ pub fn abort_internal ( ) -> ! {
55+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ] // remove `unsafe` on bootstrap bump
56+ unsafe {
57+ core:: intrinsics:: abort ( ) ;
58+ }
5659}
5760
5861pub use libc:: strlen;
Original file line number Diff line number Diff line change @@ -74,8 +74,10 @@ pub extern "C" fn floor(x: f64) -> f64 {
7474 unsafe { intrinsics:: floorf64 ( x) }
7575}
7676
77- pub unsafe fn abort_internal ( ) -> ! {
78- abi:: abort ( ) ;
77+ pub fn abort_internal ( ) -> ! {
78+ unsafe {
79+ abi:: abort ( ) ;
80+ }
7981}
8082
8183// FIXME: just a workaround to test the system
@@ -88,7 +90,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {
8890#[ cfg( not( test) ) ]
8991#[ no_mangle]
9092// NB. used by both libunwind and libpanic_abort
91- pub unsafe extern "C" fn __rust_abort ( ) {
93+ pub extern "C" fn __rust_abort ( ) {
9294 abort_internal ( ) ;
9395}
9496
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ pub unsafe fn strlen(mut s: *const c_char) -> usize {
124124 return n;
125125}
126126
127- pub unsafe fn abort_internal ( ) -> ! {
127+ pub fn abort_internal ( ) -> ! {
128128 abi:: usercalls:: exit ( true )
129129}
130130
@@ -133,7 +133,7 @@ pub unsafe fn abort_internal() -> ! {
133133#[ cfg( not( test) ) ]
134134#[ no_mangle]
135135// NB. used by both libunwind and libpanic_abort
136- pub unsafe extern "C" fn __rust_abort ( ) {
136+ pub extern "C" fn __rust_abort ( ) {
137137 abort_internal ( ) ;
138138}
139139
Original file line number Diff line number Diff line change @@ -163,6 +163,6 @@ where
163163// understandable error message like "Abort trap" rather than "Illegal
164164// instruction" that intrinsics::abort would cause, as intrinsics::abort is
165165// implemented as an illegal instruction.
166- pub unsafe fn abort_internal ( ) -> ! {
167- libc:: abort ( )
166+ pub fn abort_internal ( ) -> ! {
167+ unsafe { libc:: abort ( ) }
168168}
Original file line number Diff line number Diff line change @@ -108,6 +108,6 @@ where
108108// understandable error message like "Abort trap" rather than "Illegal
109109// instruction" that intrinsics::abort would cause, as intrinsics::abort is
110110// implemented as an illegal instruction.
111- pub unsafe fn abort_internal ( ) -> ! {
112- libc:: abort ( )
111+ pub fn abort_internal ( ) -> ! {
112+ unsafe { libc:: abort ( ) }
113113}
Original file line number Diff line number Diff line change @@ -100,8 +100,8 @@ pub unsafe fn strlen(mut s: *const c_char) -> usize {
100100 return n;
101101}
102102
103- pub unsafe fn abort_internal ( ) -> ! {
104- libc:: abort ( )
103+ pub fn abort_internal ( ) -> ! {
104+ unsafe { libc:: abort ( ) }
105105}
106106
107107pub fn hashmap_random_keys ( ) -> ( u64 , u64 ) {
Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ pub unsafe fn strlen(mut s: *const c_char) -> usize {
8181 return n;
8282}
8383
84- pub unsafe fn abort_internal ( ) -> ! {
85- crate :: arch:: wasm32:: unreachable ( )
84+ pub fn abort_internal ( ) -> ! {
85+ unsafe { crate :: arch:: wasm32:: unreachable ( ) }
8686}
8787
8888// We don't have randomness yet, but I totally used a random number generator to
Original file line number Diff line number Diff line change @@ -308,11 +308,14 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
308308//
309309// https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
310310#[ allow( unreachable_code) ]
311- pub unsafe fn abort_internal ( ) -> ! {
311+ pub fn abort_internal ( ) -> ! {
312312 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
313- {
313+ unsafe {
314314 llvm_asm ! ( "int $$0x29" :: "{ecx}" ( 7 ) :: : volatile) ; // 7 is FAST_FAIL_FATAL_APP_EXIT
315315 crate :: intrinsics:: unreachable ( ) ;
316316 }
317- crate :: intrinsics:: abort ( ) ;
317+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ] // remove `unsafe` on bootstrap bump
318+ unsafe {
319+ crate :: intrinsics:: abort ( ) ;
320+ }
318321}
You can’t perform that action at this time.
0 commit comments