Uh oh!
There was an error while loading. Please reload this page.
Fix incorrect clashing_extern_declarations warnings. - #73990
Conversation
ee6f54b to
b9efacfCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d22ea6a to
7bba12bCompareUh oh!
There was an error while loading. Please reload this page.
7bba12b to
d283429CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d283429 to
b5aab18Comparejumbatm
commented
Jul 5, 2020
I'm still working on getting |
136fe20 to
f84b951Comparejumbatm
commented
Jul 7, 2020
Alright, this good for re-review -- I have |
f84b951 to
c9ccc99CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nagisa
commented
Jul 11, 2020
Broadly lgtm, left 2 minor comments, r=me once resolved. |
c9ccc99 to
68b8a09CompareThe changes have been applied. This is good to go. e: Oops, had some unstaged formatting changes. This will be good to go once CI passes. |
68b8a09 to
9182910Comparejumbatm
commented
Jul 14, 2020
Note that I've also added a few additional commits; they fix an assertion failure and false negative I noticed while working on this. |
bors
commented
Jul 14, 2020
☔ The latest upstream changes (presumably #74342) made this pull request unmergeable. Please resolve the merge conflicts. |
470d759 to
da009d5Comparebors
commented
Jul 18, 2020
☔ The latest upstream changes (presumably #74468) made this pull request unmergeable. Please resolve the merge conflicts. |
da009d5 to
cfcb282Comparecfcb282 to
004c1c1CompareAn example of an FFI-safe enum conversion is when converting Option<NonZeroUsize> to usize. Because the Some value must be non-zero, rustc can use 0 to represent the None variant, making this conversion is safe. Furthermore, it can be relied on (and removing this optimisation already would be a breaking change).
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
- Make `is_repr_nullable_ptr` freestanding again to avoid usage of ImproperCTypesVisitor in ClashingExternDeclarations (and don't accidentally revert the ParamEnv::reveal_all() fix from a week earlier) - Revise match condition for 1 Adt, 1 primitive - Generalise check for non-null type so that it would also work for ranges which exclude any single value (all bits set, for example) - Make is_repr_nullable_ptr return the representable type instead of just a boolean, to avoid adding an additional, independent "source of truth" about the FFI-compatibility of Option-like enums. Also, rename to `repr_nullable_ptr`.
004c1c1 to
0bd292dComparejumbatm
commented
Jul 30, 2020
I've just done another rebase -- @nagisa, are you available to review and approve? I'd like to get this merged soon so that these fixes can be backported to beta, and so I can try a crater check run with this lint as deny-by-default. |
nagisa
commented
Jul 30, 2020
@bors r+ |
bors
commented
Jul 30, 2020
📌 Commit 0bd292d has been approved by |
bors
commented
Jul 30, 2020
pnkfelix
commented
Jul 30, 2020
discussed at T-compiler meeting. We decided the complexity of this PR, weighed against the bug it fixes, does not warrant a backport. However, we agreed that a PR that just changed the lint on beta to be allow-by-default would be a reasonable thing to put on the beta branch. |
pnkfelix
commented
Jul 30, 2020
@rustbot modify labels: -beta-nominated |
bors
commented
Jul 30, 2020
☀️ Test successful - checks-actions, checks-azure |
…=Mark-Simulacrum [beta] Make ClashingExternDeclarations Allow by default. As per rust-lang#73990 (comment), this PR changes `clashing_extern_declarations` to allow-by-default to sidestep current false positives & negatives on the beta branch. Note that the changes to fix the issue properly have been merged to master (see rust-lang#73990), but those changes will have to arrive on the next release train.
| /// can, return the the type that `ty` can be safely converted to, otherwise return `None`. | ||
| /// Currently restricted to function pointers, boxes, references, `core::num::NonZero*`, | ||
| /// `core::ptr::NonNull`, and `#[repr(transparent)]` newtypes. | ||
| /// FIXME: This duplicates code in codegen. |
There was a problem hiding this comment.
Does anyone involved still remember which code in codegen this duplicates? The comment as-is is unfortunately not very helpful since it is unclear where that duplication is.
There was a problem hiding this comment.
Ah never mind, this comment predates this PR, it just got moved here.
Fixes#73735, fixes#73872.
Fix clashing_extern_declarations warning for
#[repr(transparent)]structs and safely-FFI-convertible enums, and not warning for clashes of struct members of different types, but the same size.r? @nagisa