1515#![ feature( staged_api) ]
1616#![ feature( rustc_attrs) ]
1717#![ allow( internal_features) ]
18+ #![ deny( unsafe_op_in_unsafe_fn) ]
1819
1920#[ cfg( target_os = "android" ) ]
2021mod android;
@@ -36,16 +37,22 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
3637pub unsafe fn __rust_start_panic ( _payload : & mut dyn PanicPayload ) -> u32 {
3738 // Android has the ability to attach a message as part of the abort.
3839 #[ cfg( target_os = "android" ) ]
39- android:: android_set_abort_message ( _payload) ;
40+ unsafe {
41+ android:: android_set_abort_message ( _payload) ;
42+ }
4043 #[ cfg( target_os = "zkvm" ) ]
41- zkvm:: zkvm_set_abort_message ( _payload) ;
44+ unsafe {
45+ zkvm:: zkvm_set_abort_message ( _payload) ;
46+ }
4247
43- abort ( ) ;
48+ unsafe {
49+ abort ( ) ;
50+ }
4451
4552 cfg_if:: cfg_if! {
4653 if #[ cfg( any( unix, target_os = "solid_asp3" ) ) ] {
4754 unsafe fn abort( ) -> ! {
48- libc:: abort( ) ;
55+ unsafe { libc:: abort( ) ; }
4956 }
5057 } else if #[ cfg( any( target_os = "hermit" ,
5158 all( target_vendor = "fortanix" , target_env = "sgx" ) ,
@@ -57,7 +64,7 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
5764 unsafe extern "C" {
5865 pub fn __rust_abort( ) -> !;
5966 }
60- __rust_abort( ) ;
67+ unsafe { __rust_abort( ) ; }
6168 }
6269 } else if #[ cfg( all( windows, not( miri) ) ) ] {
6370 // On Windows, use the processor-specific __fastfail mechanism. In Windows 8
@@ -75,11 +82,17 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
7582 const FAST_FAIL_FATAL_APP_EXIT : usize = 7 ;
7683 cfg_if:: cfg_if! {
7784 if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
78- core:: arch:: asm!( "int $$0x29" , in( "ecx" ) FAST_FAIL_FATAL_APP_EXIT , options( noreturn, nostack) ) ;
85+ unsafe {
86+ core:: arch:: asm!( "int $$0x29" , in( "ecx" ) FAST_FAIL_FATAL_APP_EXIT , options( noreturn, nostack) ) ;
87+ }
7988 } else if #[ cfg( all( target_arch = "arm" , target_feature = "thumb-mode" ) ) ] {
80- core:: arch:: asm!( ".inst 0xDEFB" , in( "r0" ) FAST_FAIL_FATAL_APP_EXIT , options( noreturn, nostack) ) ;
89+ unsafe {
90+ core:: arch:: asm!( ".inst 0xDEFB" , in( "r0" ) FAST_FAIL_FATAL_APP_EXIT , options( noreturn, nostack) ) ;
91+ }
8192 } else if #[ cfg( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ] {
82- core:: arch:: asm!( "brk 0xF003" , in( "x0" ) FAST_FAIL_FATAL_APP_EXIT , options( noreturn, nostack) ) ;
93+ unsafe {
94+ core:: arch:: asm!( "brk 0xF003" , in( "x0" ) FAST_FAIL_FATAL_APP_EXIT , options( noreturn, nostack) ) ;
95+ }
8396 } else {
8497 core:: intrinsics:: abort( ) ;
8598 }
@@ -93,7 +106,7 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
93106 }
94107
95108 unsafe fn abort( ) -> ! {
96- teeos:: TEE_Panic ( 1 ) ;
109+ unsafe { teeos:: TEE_Panic ( 1 ) ; }
97110 }
98111 } else {
99112 unsafe fn abort( ) -> ! {
0 commit comments