Overhaul improper_ctypes output#48221
Merged
bors merged 7 commits intorust-lang:masterfrom Feb 24, 2018
Merged
Conversation
Contributor
|
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
Member
|
I think it'd be helpful to make that a UI test and have the before/after be a diff in GH (so separate commit moving the file) |
Contributor
Author
|
Great idea, will do that (and fix the travis failure) tomorrow. |
4e84ec6 to
8cac9a6
Compare
Contributor
Author
|
Done. |
Collaborator
|
☔ The latest upstream changes (presumably #48203) made this pull request unmergeable. Please resolve the merge conflicts. |
added 6 commits
February 15, 2018 17:47
…enums This dates back to at least rust-lang#26583. At the time, usize and isize were considered ffi-unsafe to nudge people away from them, but this changed in the aforementioned PR, making it inconsistent to complain about it in enum discriminants. In fact, repr(usize) is probably the best way to interface with `enum Foo : size_t { ... }`.
- Always name the non-FFI-safe - Explain *why* the type is not FFI-safe - Stop vaguely gesturing at structs/enums/unions if the non-FFI-safe types occured in a field. The last part is arguably a regression, but it's minor now that the non-FFI-safe type is actually named. Removing it avoids some code duplication.
The suggestion is unconditional, so following it could lead to further errors. This is already the case for the repr(C) suggestion, which makes this acceptable, though not *good*. Checking up-front whether the suggestion can help would be great but applies more broadly (and would require some refactoring to avoid duplicating the checks).
8cac9a6 to
4454a2d
Compare
Contributor
Author
|
Rebased. |
Contributor
|
r=me once travis passes |
…objects It's unhelpful since raw pointers to trait objects are also FFI-unsafe and casting to a thin raw pointer loses the vtable. There are working solutions that _involve_ raw pointers but they're too complex to explain in one line and have serious trade offs.
4454a2d to
051ea5c
Compare
Contributor
Author
|
@bors r=estebank |
Collaborator
|
📌 Commit 051ea5c has been approved by |
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Feb 19, 2018
…bank Overhaul improper_ctypes output This snowballed into a rather big set of improvements to the diagnostics of the improper_ctypes lint. See commits for details, including effects of each change on the `compile-fail/improper-ctypes.rs` test (now a UI test), which is pretty gnarly and hopefully not representative of real code, but covers a lot of different error cases. Fixes rust-lang#42050
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Feb 20, 2018
bors
added a commit
that referenced
this pull request
Feb 20, 2018
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Feb 23, 2018
…bank Overhaul improper_ctypes output This snowballed into a rather big set of improvements to the diagnostics of the improper_ctypes lint. See commits for details, including effects of each change on the `compile-fail/improper-ctypes.rs` test (now a UI test), which is pretty gnarly and hopefully not representative of real code, but covers a lot of different error cases. Fixes rust-lang#42050
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This snowballed into a rather big set of improvements to the diagnostics of the improper_ctypes lint. See commits for details, including effects of each change on the
compile-fail/improper-ctypes.rstest (now a UI test), which is pretty gnarly and hopefully not representative of real code, but covers a lot of different error cases.Fixes #42050