File tree 14 files changed +21
-19
lines changed
Filter options
14 files changed +21
-19
lines changed
Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ wasm-bindgen = "0.2.100"
190
190
[workspace .lints .rust ]
191
191
unsafe_code = " allow"
192
192
unsafe_op_in_unsafe_fn = " deny"
193
+ missing_unsafe_on_extern = " deny"
194
+ unsafe_attr_outside_unsafe = " deny"
193
195
194
196
[workspace .lints .clippy ]
195
197
perf = " warn"
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use std::{cmp, ffi, io};
6
6
#[ cfg( windows) ]
7
7
use libc:: commit as fsync;
8
8
#[ cfg( windows) ]
9
- extern "C" {
9
+ unsafe extern "C" {
10
10
#[ link_name = "_chsize_s" ]
11
11
fn ftruncate ( fd : i32 , len : i64 ) -> i32 ;
12
12
}
@@ -74,7 +74,7 @@ impl Fd {
74
74
75
75
#[ cfg( windows) ]
76
76
pub fn to_raw_handle ( & self ) -> io:: Result < std:: os:: windows:: io:: RawHandle > {
77
- extern "C" {
77
+ unsafe extern "C" {
78
78
fn _get_osfhandle ( fd : i32 ) -> libc:: intptr_t ;
79
79
}
80
80
let handle = unsafe { suppress_iph ! ( _get_osfhandle( self . 0 ) ) } ;
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ pub mod windows {
94
94
}
95
95
}
96
96
97
- extern "C" {
97
+ unsafe extern "C" {
98
98
fn _get_osfhandle ( fd : i32 ) -> libc:: intptr_t ;
99
99
}
100
100
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ pub mod __macro_private {
41
41
libc:: uintptr_t ,
42
42
) ;
43
43
#[ cfg( target_env = "msvc" ) ]
44
- extern "C" {
44
+ unsafe extern "C" {
45
45
pub fn _set_thread_local_invalid_parameter_handler (
46
46
pNew : InvalidParamHandler ,
47
47
) -> InvalidParamHandler ;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ pub fn last_os_error() -> io::Error {
23
23
let err = io:: Error :: last_os_error ( ) ;
24
24
// FIXME: probably not ideal, we need a bigger dichotomy between GetLastError and errno
25
25
if err. raw_os_error ( ) == Some ( 0 ) {
26
- extern "C" {
26
+ unsafe extern "C" {
27
27
fn _get_errno ( pValue : * mut i32 ) -> i32 ;
28
28
}
29
29
let mut errno = 0 ;
@@ -44,7 +44,7 @@ pub fn last_os_error() -> io::Error {
44
44
pub fn last_posix_errno ( ) -> i32 {
45
45
let err = io:: Error :: last_os_error ( ) ;
46
46
if err. raw_os_error ( ) == Some ( 0 ) {
47
- extern "C" {
47
+ unsafe extern "C" {
48
48
fn _get_errno ( pValue : * mut i32 ) -> i32 ;
49
49
}
50
50
let mut errno = 0 ;
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ pub fn run(init: impl FnOnce(&mut VirtualMachine) + 'static) -> ExitCode {
78
78
// don't translate newlines (\r\n <=> \n)
79
79
#[ cfg( windows) ]
80
80
{
81
- extern "C" {
81
+ unsafe extern "C" {
82
82
fn _setmode ( fd : i32 , flags : i32 ) -> i32 ;
83
83
}
84
84
unsafe {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ struct lconv {
30
30
}
31
31
32
32
#[ cfg( windows) ]
33
- extern "C" {
33
+ unsafe extern "C" {
34
34
fn localeconv ( ) -> * mut lconv ;
35
35
}
36
36
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ mod platform {
111
111
set. __nfds = 0 ;
112
112
}
113
113
114
- extern "C" {
114
+ unsafe extern "C" {
115
115
pub fn select (
116
116
nfds : libc:: c_int ,
117
117
readfds : * mut fd_set ,
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ mod msvcrt {
24
24
unsafe { suppress_iph ! ( _setmode( fd, libc:: O_BINARY ) ) } ;
25
25
}
26
26
27
- extern "C" {
27
+ unsafe extern "C" {
28
28
fn _getch ( ) -> i32 ;
29
29
fn _getwch ( ) -> u32 ;
30
30
fn _getche ( ) -> i32 ;
@@ -70,7 +70,7 @@ mod msvcrt {
70
70
Ok ( ( ) )
71
71
}
72
72
73
- extern "C" {
73
+ unsafe extern "C" {
74
74
fn _setmode ( fd : i32 , flags : i32 ) -> i32 ;
75
75
}
76
76
@@ -84,7 +84,7 @@ mod msvcrt {
84
84
}
85
85
}
86
86
87
- extern "C" {
87
+ unsafe extern "C" {
88
88
fn _open_osfhandle ( osfhandle : isize , flags : i32 ) -> i32 ;
89
89
fn _get_osfhandle ( fd : i32 ) -> libc:: intptr_t ;
90
90
}
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ pub(crate) mod module {
116
116
117
117
// cwait is available on MSVC only (according to CPython)
118
118
#[ cfg( target_env = "msvc" ) ]
119
- extern "C" {
119
+ unsafe extern "C" {
120
120
fn _cwait ( termstat : * mut i32 , procHandle : intptr_t , action : i32 ) -> intptr_t ;
121
121
}
122
122
@@ -194,7 +194,7 @@ pub(crate) mod module {
194
194
}
195
195
196
196
#[ cfg( target_env = "msvc" ) ]
197
- extern "C" {
197
+ unsafe extern "C" {
198
198
fn _wexecv ( cmdname : * const u16 , argv : * const * const u16 ) -> intptr_t ;
199
199
}
200
200
Original file line number Diff line number Diff line change @@ -966,7 +966,7 @@ pub(super) mod _os {
966
966
967
967
#[ pyfunction]
968
968
fn abort ( ) {
969
- extern "C" {
969
+ unsafe extern "C" {
970
970
fn abort ( ) ;
971
971
}
972
972
unsafe { abort( ) }
Original file line number Diff line number Diff line change @@ -971,7 +971,7 @@ pub mod module {
971
971
#[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "netbsd" , ) ) ]
972
972
#[ pyfunction]
973
973
fn lchmod ( path : OsPath , mode : u32 , vm : & VirtualMachine ) -> PyResult < ( ) > {
974
- extern "C" {
974
+ unsafe extern "C" {
975
975
fn lchmod ( path : * const libc:: c_char , mode : libc:: mode_t ) -> libc:: c_int ;
976
976
}
977
977
let c_path = path. clone ( ) . into_cstring ( vm) ?;
@@ -1605,7 +1605,7 @@ pub mod module {
1605
1605
// from libstd:
1606
1606
// https://github.com/rust-lang/rust/blob/daecab3a784f28082df90cebb204998051f3557d/src/libstd/sys/unix/fs.rs#L1251
1607
1607
#[ cfg( target_os = "macos" ) ]
1608
- extern "C" {
1608
+ unsafe extern "C" {
1609
1609
fn fcopyfile (
1610
1610
in_fd : libc:: c_int ,
1611
1611
out_fd : libc:: c_int ,
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ pub(crate) mod _signal {
78
78
pub const SIG_ERR : sighandler_t = -1 as _ ;
79
79
80
80
#[ cfg( all( unix, not( target_os = "redox" ) ) ) ]
81
- extern "C" {
81
+ unsafe extern "C" {
82
82
fn siginterrupt ( sig : i32 , flag : i32 ) -> i32 ;
83
83
}
84
84
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
17
17
18
18
#[ cfg( not( target_env = "msvc" ) ) ]
19
19
#[ cfg( not( target_arch = "wasm32" ) ) ]
20
- extern "C" {
20
+ unsafe extern "C" {
21
21
#[ cfg( not( target_os = "freebsd" ) ) ]
22
22
#[ link_name = "daylight" ]
23
23
static c_daylight: std:: ffi:: c_int ;
You can’t perform that action at this time.
0 commit comments