Skip to content

Support Result<T, E> across FFI when niche optimization can be used #122253

New issue

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

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

Already on GitHub? # to your account

Merged
merged 9 commits into from
May 5, 2024

Conversation

MasterAwesome
Copy link
Contributor

@MasterAwesome MasterAwesome commented Mar 9, 2024

Allow allow enums like Result<T, E> to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: #110503

Additional ABI and codegen tests were added in #115372

@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2024

r? @cjgillot

rustbot has assigned @cjgillot.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 9, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@MasterAwesome MasterAwesome marked this pull request as ready for review March 9, 2024 22:36
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

r? compiler

@rustbot rustbot assigned petrochenkov and unassigned cjgillot Mar 10, 2024
@petrochenkov
Copy link
Contributor

Hmmm.
r? @RalfJung

@rustbot rustbot assigned RalfJung and unassigned petrochenkov Mar 12, 2024
@RalfJung
Copy link
Member

Sorry, I can't review these lint implementations.
Maybe r? @davidtwco ; I see you've worked on the improper-ctypes lint in the past.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 18, 2024
@MasterAwesome MasterAwesome requested a review from davidtwco March 19, 2024 03:32
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 19, 2024
@bors
Copy link
Collaborator

bors commented Apr 23, 2024

☔ The latest upstream changes (presumably #124271) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me after rebasing

Allow allow enums like `Result<T, E>` to be used across FFI if the
T/E can be niche optimized and the non-niche-optimized type is FFI safe.
Fields are disallowed so checking the top attribute is enough.
@MasterAwesome
Copy link
Contributor Author

@bors r=davidtwco

@bors
Copy link
Collaborator

bors commented Apr 24, 2024

@MasterAwesome: 🔑 Insufficient privileges: Not in reviewers

@MasterAwesome
Copy link
Contributor Author

I guess I don't have permissions @davidtwco, can you queue this in?

@MasterAwesome MasterAwesome requested a review from davidtwco April 29, 2024 23:13
@Dylan-DPC
Copy link
Member

@bors r=davidtwco

@bors
Copy link
Collaborator

bors commented May 1, 2024

📌 Commit ed532cc has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2024
@bors
Copy link
Collaborator

bors commented May 1, 2024

⌛ Testing commit ed532cc with merge 4d96c3e...

bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2024
Support Result<T, E> across FFI when niche optimization can be used

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
@fmease
Copy link
Member

fmease commented May 3, 2024

⌛ Testing commit ed532cc with merge 4d96c3e...

That's a zombie.

@bors retry for good measure.

fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#122253 (Support Result<T, E> across FFI when niche optimization can be used)
 - rust-lang#123892 (Document That `f16` And `f128` Hardware Support is Limited)
 - rust-lang#124458 (Implement lldb formattter for "clang encoded" enums (LLDB 18.1+))
 - rust-lang#124459 (Stabilize exclusive_range_pattern)
 - rust-lang#124711 (Migrate `run-make/doctests-runtool` to rmake)
 - rust-lang#124725 (Meta: Enable the brand new triagebot transfer command)
 - rust-lang#124727 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#122253 (Support Result<T, E> across FFI when niche optimization can be used)
 - rust-lang#123892 (Document That `f16` And `f128` Hardware Support is Limited)
 - rust-lang#124458 (Implement lldb formattter for "clang encoded" enums (LLDB 18.1+))
 - rust-lang#124459 (Stabilize exclusive_range_pattern)
 - rust-lang#124711 (Migrate `run-make/doctests-runtool` to rmake)
 - rust-lang#124725 (Meta: Enable the brand new triagebot transfer command)
 - rust-lang#124727 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented May 5, 2024

⌛ Testing commit ed532cc with merge 654afe3...

@bors
Copy link
Collaborator

bors commented May 5, 2024

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 654afe3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 5, 2024
@bors bors merged commit 654afe3 into rust-lang:master May 5, 2024
13 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 5, 2024
@Kobzol
Copy link
Contributor

Kobzol commented May 5, 2024

This PR has been merged by accident, without the full test suite being run. It was my fault (#124631 got merged and it broke our CI). @MasterAwesome Could you please create a new PR with your branch against the latest version of origin/master? Thank you, and sorry for the mess.

@dtolnay
Copy link
Member

dtolnay commented May 5, 2024

New PR, from the same branch: #124747

fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to rust-lang#122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to rust-lang#122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to rust-lang#122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
@dtolnay dtolnay added the A-FFI Area: Foreign function interface (FFI) label Jan 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-FFI Area: Foreign function interface (FFI) merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.