-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Support Result<T, E> across FFI when niche optimization can be used (v2) #124747
Conversation
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.
Couldn't find documentation supporting that single-variant `#[repr(Rust)]` enums with RHS assigned work as expected with this change. ```rust enum Variants { A = 17, } // Would this be zero sized optimized guaranteed? ```
@bors r=davidtwco |
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
Rollup of 6 pull requests Successful merges: - rust-lang#124146 (Triagebot: Rename `macos` ping group to `apple`) - rust-lang#124742 (Add `rustfmt` cfg to well known cfgs list) - rust-lang#124745 (Implement lldb formattter for "clang encoded" enums (LLDB 18.1+) (v2)) - rust-lang#124747 (Support Result<T, E> across FFI when niche optimization can be used (v2)) - rust-lang#124765 ([rustdoc] Fix bad color for setting cog in ayu theme) - rust-lang#124768 ([resubmission] Meta: Enable the brand new triagebot transfer command) r? `@ghost` `@rustbot` modify labels: rollup
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
Rollup of 5 pull requests Successful merges: - rust-lang#124742 (Add `rustfmt` cfg to well known cfgs list) - rust-lang#124747 (Support Result<T, E> across FFI when niche optimization can be used (v2)) - rust-lang#124753 (Migrate `run-make/rustdoc-error-lines` to new `rmake.rs`) - rust-lang#124765 ([rustdoc] Fix bad color for setting cog in ayu theme) - rust-lang#124768 ([resubmission] Meta: Enable the brand new triagebot transfer command) r? `@ghost` `@rustbot` modify labels: rollup
☀️ Test successful - checks-actions |
Finished benchmarking commit (80420a6): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 675.885s -> 676.339s (0.07%) |
This PR is identical to #122253, which was approved and merged but then removed from master by a force-push due to a CI bug.
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: #110503
Additional ABI and codegen tests were added in #115372