Skip to content

Commit

Permalink
Convert compile-fail/lint-ctypes.rs to ui test
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Kruppe committed Feb 15, 2018
1 parent 1670a53 commit 1f0e1a0
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 0 deletions.
File renamed without changes.
128 changes: 128 additions & 0 deletions src/test/ui/lint-ctypes.stderr
@@ -0,0 +1,128 @@
error: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
--> $DIR/lint-ctypes.rs:54:28
|
54 | pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-ctypes.rs:11:9
|
11 | #![deny(improper_ctypes)]
| ^^^^^^^^^^^^^^^

error: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
--> $DIR/lint-ctypes.rs:55:28
|
55 | pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without
| ^^^^^^^^^^

error: found Rust slice type in foreign module, consider using a raw pointer instead
--> $DIR/lint-ctypes.rs:56:26
|
56 | pub fn slice_type(p: &[u32]); //~ ERROR: found Rust slice type
| ^^^^^^

error: found Rust type `str` in foreign module; consider using a `*const libc::c_char`
--> $DIR/lint-ctypes.rs:57:24
|
57 | pub fn str_type(p: &str); //~ ERROR: found Rust type
| ^^^^

error: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
--> $DIR/lint-ctypes.rs:58:24
|
58 | pub fn box_type(p: Box<u32>); //~ ERROR found struct without
| ^^^^^^^^

error: found Rust type `char` in foreign module, while `u32` or `libc::wchar_t` should be used
--> $DIR/lint-ctypes.rs:59:25
|
59 | pub fn char_type(p: char); //~ ERROR found Rust type
| ^^^^

error: found Rust type `i128` in foreign module, but 128-bit integers don't currently have a known stable ABI
--> $DIR/lint-ctypes.rs:60:25
|
60 | pub fn i128_type(p: i128); //~ ERROR found Rust type
| ^^^^

error: found Rust type `u128` in foreign module, but 128-bit integers don't currently have a known stable ABI
--> $DIR/lint-ctypes.rs:61:25
|
61 | pub fn u128_type(p: u128); //~ ERROR found Rust type
| ^^^^

error: found Rust trait type in foreign module, consider using a raw pointer instead
--> $DIR/lint-ctypes.rs:62:26
|
62 | pub fn trait_type(p: &Clone); //~ ERROR found Rust trait type
| ^^^^^^

error: found Rust tuple type in foreign module; consider using a struct instead
--> $DIR/lint-ctypes.rs:63:26
|
63 | pub fn tuple_type(p: (i32, i32)); //~ ERROR found Rust tuple type
| ^^^^^^^^^^

error: found Rust tuple type in foreign module; consider using a struct instead
--> $DIR/lint-ctypes.rs:64:27
|
64 | pub fn tuple_type2(p: I32Pair); //~ ERROR found Rust tuple type
| ^^^^^^^

error: found zero-size struct in foreign module, consider adding a member to this struct
--> $DIR/lint-ctypes.rs:65:25
|
65 | pub fn zero_size(p: ZeroSize); //~ ERROR found zero-size struct
| ^^^^^^^^

error: found zero-sized type composed only of phantom-data in a foreign-function.
--> $DIR/lint-ctypes.rs:66:33
|
66 | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR found zero-sized type
| ^^^^^^^^^^^^^^^^^^^^^^^

error: found zero-sized type composed only of phantom-data in a foreign-function.
--> $DIR/lint-ctypes.rs:68:12
|
68 | -> ::std::marker::PhantomData<bool>; //~ ERROR: found zero-sized type
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: found function pointer with Rust calling convention in foreign module; consider using an `extern` function pointer
--> $DIR/lint-ctypes.rs:69:23
|
69 | pub fn fn_type(p: RustFn); //~ ERROR found function pointer with Rust
| ^^^^^^

error: found function pointer with Rust calling convention in foreign module; consider using an `extern` function pointer
--> $DIR/lint-ctypes.rs:70:24
|
70 | pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust
| ^^^^

error: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
--> $DIR/lint-ctypes.rs:71:28
|
71 | pub fn fn_contained(p: RustBadRet); //~ ERROR: found struct without
| ^^^^^^^^^^

error: found non-foreign-function-safe member in struct marked #[repr(C)]: found Rust type `i128` in foreign module, but 128-bit integers don't currently have a known stable ABI
--> $DIR/lint-ctypes.rs:72:32
|
72 | pub fn transparent_i128(p: TransparentI128); //~ ERROR: found Rust type `i128`
| ^^^^^^^^^^^^^^^

error: found non-foreign-function-safe member in struct marked #[repr(C)]: found Rust type `str` in foreign module; consider using a `*const libc::c_char`
--> $DIR/lint-ctypes.rs:73:31
|
73 | pub fn transparent_str(p: TransparentStr); //~ ERROR: found Rust type `str`
| ^^^^^^^^^^^^^^

error: found non-foreign-function-safe member in struct marked #[repr(C)]: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
--> $DIR/lint-ctypes.rs:74:30
|
74 | pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: found struct without
| ^^^^^^^^^^^^^^^^

error: aborting due to 20 previous errors

0 comments on commit 1f0e1a0

Please sign in to comment.