15
15
#![ feature( staged_api) ]
16
16
#![ feature( rustc_attrs) ]
17
17
#![ allow( internal_features) ]
18
+ #![ deny( unsafe_op_in_unsafe_fn) ]
18
19
19
20
#[ cfg( target_os = "android" ) ]
20
21
mod android;
@@ -36,16 +37,22 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
36
37
pub unsafe fn __rust_start_panic ( _payload : & mut dyn PanicPayload ) -> u32 {
37
38
// Android has the ability to attach a message as part of the abort.
38
39
#[ cfg( target_os = "android" ) ]
39
- android:: android_set_abort_message ( _payload) ;
40
+ unsafe {
41
+ android:: android_set_abort_message ( _payload) ;
42
+ }
40
43
#[ cfg( target_os = "zkvm" ) ]
41
- zkvm:: zkvm_set_abort_message ( _payload) ;
44
+ unsafe {
45
+ zkvm:: zkvm_set_abort_message ( _payload) ;
46
+ }
42
47
43
- abort ( ) ;
48
+ unsafe {
49
+ abort ( ) ;
50
+ }
44
51
45
52
cfg_if:: cfg_if! {
46
53
if #[ cfg( any( unix, target_os = "solid_asp3" ) ) ] {
47
54
unsafe fn abort( ) -> ! {
48
- libc:: abort( ) ;
55
+ unsafe { libc:: abort( ) ; }
49
56
}
50
57
} else if #[ cfg( any( target_os = "hermit" ,
51
58
all( target_vendor = "fortanix" , target_env = "sgx" ) ,
@@ -57,7 +64,7 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
57
64
unsafe extern "C" {
58
65
pub fn __rust_abort( ) -> !;
59
66
}
60
- __rust_abort( ) ;
67
+ unsafe { __rust_abort( ) ; }
61
68
}
62
69
} else if #[ cfg( all( windows, not( miri) ) ) ] {
63
70
// 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 {
75
82
const FAST_FAIL_FATAL_APP_EXIT : usize = 7 ;
76
83
cfg_if:: cfg_if! {
77
84
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
+ }
79
88
} 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
+ }
81
92
} 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
+ }
83
96
} else {
84
97
core:: intrinsics:: abort( ) ;
85
98
}
@@ -93,7 +106,7 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
93
106
}
94
107
95
108
unsafe fn abort( ) -> ! {
96
- teeos:: TEE_Panic ( 1 ) ;
109
+ unsafe { teeos:: TEE_Panic ( 1 ) ; }
97
110
}
98
111
} else {
99
112
unsafe fn abort( ) -> ! {
0 commit comments