File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ extern {
6565 pub fn transparent_i128 ( p : TransparentI128 ) ; //~ ERROR: uses type `i128`
6666 pub fn transparent_str ( p : TransparentStr ) ; //~ ERROR: uses type `str`
6767 pub fn transparent_fn ( p : TransparentBadFn ) ; //~ ERROR: uses type `std::boxed::Box<u32>`
68+ pub fn raw_array ( arr : [ u8 ; 8 ] ) ; //~ ERROR: uses type `[u8; 8]`
69+
70+ pub static static_u128_type: u128 ; //~ ERROR: uses type `u128`
71+ pub static static_u128_array_type: [ u128 ; 16 ] ; //~ ERROR: uses type `u128`
6872
6973 pub fn good3 ( fptr : Option < extern fn ( ) > ) ;
7074 pub fn good4 ( aptr : & [ u8 ; 4 as usize ] ) ;
@@ -83,6 +87,9 @@ extern {
8387 pub fn good17 ( p : TransparentCustomZst ) ;
8488 #[ allow( improper_ctypes) ]
8589 pub fn good18 ( _: & String ) ;
90+ pub fn good20 ( arr : * const [ u8 ; 8 ] ) ;
91+ pub static good21: [ u8 ; 8 ] ;
92+
8693}
8794
8895#[ allow( improper_ctypes) ]
Original file line number Diff line number Diff line change @@ -197,5 +197,30 @@ LL | pub fn transparent_fn(p: TransparentBadFn);
197197 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
198198 = note: this struct has unspecified layout
199199
200- error: aborting due to 20 previous errors
200+ error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
201+ --> $DIR/lint-ctypes.rs:68:27
202+ |
203+ LL | pub fn raw_array(arr: [u8; 8]);
204+ | ^^^^^^^ not FFI-safe
205+ |
206+ = help: consider passing a pointer to the array
207+ = note: passing raw arrays by value is not FFI-safe
208+
209+ error: `extern` block uses type `u128`, which is not FFI-safe
210+ --> $DIR/lint-ctypes.rs:70:34
211+ |
212+ LL | pub static static_u128_type: u128;
213+ | ^^^^ not FFI-safe
214+ |
215+ = note: 128-bit integers don't currently have a known stable ABI
216+
217+ error: `extern` block uses type `u128`, which is not FFI-safe
218+ --> $DIR/lint-ctypes.rs:71:40
219+ |
220+ LL | pub static static_u128_array_type: [u128; 16];
221+ | ^^^^^^^^^^ not FFI-safe
222+ |
223+ = note: 128-bit integers don't currently have a known stable ABI
224+
225+ error: aborting due to 23 previous errors
201226
You can’t perform that action at this time.
0 commit comments