diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index cf6cc9bb7ce12..c95d8b7bf3e88 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -497,14 +497,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { FfiSafe } - ty::TyInt(ast::TyIs) => { - FfiUnsafe("found Rust type `isize` in foreign module, while \ - `libc::c_int` or `libc::c_long` should be used") - } - ty::TyUint(ast::TyUs) => { - FfiUnsafe("found Rust type `usize` in foreign module, while \ - `libc::c_uint` or `libc::c_ulong` should be used") - } ty::TyChar => { FfiUnsafe("found Rust type `char` in foreign module, while \ `u32` or `libc::wchar_t` should be used") diff --git a/src/test/compile-fail/issue-16250.rs b/src/test/compile-fail/issue-16250.rs index b5aa3568122ad..288fe4a9abb82 100644 --- a/src/test/compile-fail/issue-16250.rs +++ b/src/test/compile-fail/issue-16250.rs @@ -10,8 +10,10 @@ #![deny(warnings)] +pub struct Foo; + extern { - pub fn foo(x: (isize)); //~ ERROR found Rust type `isize` in foreign module + pub fn foo(x: (Foo)); //~ ERROR found struct without } fn main() { diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index 4daba86679d5d..5c49098d87053 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -27,12 +27,11 @@ pub struct ZeroSize; pub type RustFn = fn(); pub type RustBadRet = extern fn() -> Box; pub type CVoidRet = (); +pub struct Foo; extern { - pub fn bare_type1(size: isize); //~ ERROR: found Rust type - pub fn bare_type2(size: usize); //~ ERROR: found Rust type - pub fn ptr_type1(size: *const isize); //~ ERROR: found Rust type - pub fn ptr_type2(size: *const usize); //~ ERROR: found Rust type + pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without + pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without pub fn slice_type(p: &[u32]); //~ ERROR: found Rust slice type pub fn str_type(p: &str); //~ ERROR: found Rust type pub fn box_type(p: Box); //~ ERROR found Rust type @@ -55,6 +54,8 @@ extern { pub fn good8(fptr: extern fn() -> !); pub fn good9() -> (); pub fn good10() -> CVoidRet; + pub fn good11(size: isize); + pub fn good12(size: usize); } fn main() { diff --git a/src/test/compile-fail/warn-foreign-int-types.rs b/src/test/run-pass/foreign-int-types.rs similarity index 73% rename from src/test/compile-fail/warn-foreign-int-types.rs rename to src/test/run-pass/foreign-int-types.rs index b77f25a0a344f..5ea0ef6c7ba3b 100644 --- a/src/test/compile-fail/warn-foreign-int-types.rs +++ b/src/test/run-pass/foreign-int-types.rs @@ -13,9 +13,8 @@ mod xx { extern { - pub fn strlen(str: *const u8) -> usize; //~ ERROR found Rust type `usize` - pub fn foo(x: isize, y: usize); //~ ERROR found Rust type `isize` - //~^ ERROR found Rust type `usize` + pub fn strlen(str: *const u8) -> usize; + pub fn foo(x: isize, y: usize); } }