14ea7a777f
This commit adds a new lint - `improper_ctypes_definitions` - which functions identically to `improper_ctypes`, but on `extern "C" fn` definitions (as opposed to `improper_ctypes`'s `extern "C" {}` declarations). Signed-off-by: David Wood <david@davidtw.co>
24 lines
358 B
Rust
24 lines
358 B
Rust
// run-pass
|
|
#[allow(improper_ctypes_definitions)]
|
|
pub extern "C" fn tuple2() -> (u16, u8) {
|
|
(1, 2)
|
|
}
|
|
|
|
#[allow(improper_ctypes_definitions)]
|
|
pub extern "C" fn tuple3() -> (u8, u8, u8) {
|
|
(1, 2, 3)
|
|
}
|
|
|
|
pub fn test2() -> u8 {
|
|
tuple2().1
|
|
}
|
|
|
|
pub fn test3() -> u8 {
|
|
tuple3().2
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(test2(), 2);
|
|
assert_eq!(test3(), 3);
|
|
}
|