-
Notifications
You must be signed in to change notification settings - Fork 64
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 Rust returning -> Result<_, String>
#296
Conversation
0b61f34
to
05b0be9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Minor feedback, then we can land this. Thank you for working on this.
crates/swift-bridge-ir/src/codegen/codegen_tests/result_codegen_tests.rs
Outdated
Show resolved
Hide resolved
SwiftRustIntegrationTestRunner/SwiftRustIntegrationTestRunnerTests/ResultTests.swift
Outdated
Show resolved
Hide resolved
Please update your PR body with an example of a simple bridge module that is now possible. This example will be used in the release notes. Can just be a bridge module with a simple function that returns |
-> Result<_, String>
* document relationships between impl & tests
05b0be9
to
5027a48
Compare
Looks great. Thank you for your first contribution. I'll merge once tests pass. |
At least on my machine, this causes an error on Swift 6:
|
We need to make the class thread-safe. See: #150 (comment) |
I don't think there's a way to (safely) make a mutable heap reference Two ways I could see:
Copying is definitely wrong for most strings, but for errors it might strike the right balance, no? Sorry if I'm retreading a topic that's already been covered, or if I misunderstood something. Separately, I'm confused that this PR adds |
As of Jan 2025, Swift's error handling documentation mentions The idea is to generate more idiomatic Swift code. If an argument is made for making this configurable via an attribute (i.e. Ah, yeah, We'll want to either start running CI against Swift 5 and Swift 6, or just drop Swift 5 support entirely. I'm confused as to how implementing |
Opened an issue: #309 |
This reverts commit c45a38c.
Err, no I was wrong here. Explained here -> #309 (comment) |
Support Rust returning
-> Result<_, String>
, e.g.:Incorporate the changes from #282 to implement swift's
Error
protocol for ruststring, & extend them with the tests requested in #295 (comment)thanks for your work on this lovely crate!