Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Don't lint about isize/usize in FFI #28779

Merged
merged 1 commit into from
Oct 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-16250.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 5 additions & 4 deletions src/test/compile-fail/lint-ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ pub struct ZeroSize;
pub type RustFn = fn();
pub type RustBadRet = extern fn() -> Box<u32>;
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<u32>); //~ ERROR found Rust type
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down