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

Conversation

Projects
None yet
9 participants
@alexcrichton
Copy link
Member

alexcrichton commented Sep 30, 2015

This lint warning was originally intended to help against misuse of the old Rust
int and uint types in FFI bindings where the Rust int was not equal to the
C int. This confusion no longer exists (as Rust's types are now isize and
usize), and as a result the need for this lint has become much less over time.

Additionally, starting with the RFC for libc it's likely that isize and
usize will be quite common in FFI bindings (e.g. they're the definition of
size_t and ssize_t on many platforms).

This commit disables these lints to instead consider isize and usize valid
types to have in FFI signatures.

rustc: Don't lint about isize/usize in FFI
This lint warning was originally intended to help against misuse of the old Rust
`int` and `uint` types in FFI bindings where the Rust `int` was not equal to the
C `int`. This confusion no longer exists (as Rust's types are now `isize` and
`usize`), and as a result the need for this lint has become much less over time.

Additionally, starting with [the RFC for libc][rfc] it's likely that `isize` and
`usize` will be quite common in FFI bindings (e.g. they're the definition of
`size_t` and `ssize_t` on many platforms).

[rfc]: rust-lang/rfcs#1291

This commit disables these lints to instead consider `isize` and `usize` valid
types to have in FFI signatures.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Sep 30, 2015

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Sep 30, 2015

r? @nrc

@rust-highfive rust-highfive assigned nrc and unassigned pcwalton Sep 30, 2015

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Sep 30, 2015

@briansmith

This comment has been minimized.

Copy link

briansmith commented Sep 30, 2015

Great. Although I'd figured out how to change the lint implementation easy enough, I was struggling to figure out how to update the tests. Thanks for taking this over.

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Sep 30, 2015

No problem! Thanks again for proposing the change :)

@bluss bluss added the relnotes label Oct 1, 2015

@nrc

This comment has been minimized.

Copy link
Member

nrc commented Oct 5, 2015

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 5, 2015

📌 Commit bd6758a has been approved by nrc

bors added a commit that referenced this pull request Oct 6, 2015

Auto merge of #28779 - alexcrichton:ffi-isize-usize, r=nrc
This lint warning was originally intended to help against misuse of the old Rust
`int` and `uint` types in FFI bindings where the Rust `int` was not equal to the
C `int`. This confusion no longer exists (as Rust's types are now `isize` and
`usize`), and as a result the need for this lint has become much less over time.

Additionally, starting with [the RFC for libc][rfc] it's likely that `isize` and
`usize` will be quite common in FFI bindings (e.g. they're the definition of
`size_t` and `ssize_t` on many platforms).

[rfc]: rust-lang/rfcs#1291

This commit disables these lints to instead consider `isize` and `usize` valid
types to have in FFI signatures.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 6, 2015

⌛️ Testing commit bd6758a with merge 88b6a50...

@bors bors merged commit bd6758a into rust-lang:master Oct 6, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Oct 6, 2015

Nominating for a beta backport, I think this will be an instrumental part of rust-lang/rfcs#1291 and I think the impact is pretty low.

@alexcrichton alexcrichton deleted the alexcrichton:ffi-isize-usize branch Oct 6, 2015

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Oct 16, 2015

@rust-lang/lang I have no opinion about backporting this to beta; I certainly don't object, but I also don't think its the end of the world if we end up waiting a release cycle for this change to the lint.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 16, 2015

I wouldn't normally want to backport this, but the patch is small, and so if @alexcrichton is in favor I'm ok with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.