You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should emit a typed throw for Rust functions that return a Result.
// Currently generated Swift (before completing this issue)
func grow()throws{
// ... calls Rust
}
// Typed throw (after completing this issue)
func grow()throws(MyError){
// ... calls Rust
}
We can add a #[swift_bridge(typed_throw)] attribute that allows people to use this in the 0.1.x branch, then remove the attribute once Swift 6 is the lowest Swift version supported by our "Minimum Supported Swift Version` policy #288
#[swift_bridge::bridge]mod ffi {// We would stop requiring this attribute whenever we dropped support for Swift 5.xextern"Rust"{#[swift_bridge(typed_throw)]fngrow() -> Result<(),()>;}}
The text was updated successfully, but these errors were encountered:
So, we may not want to default to using typed throws and instead keep the #[swift_bridge(typed_throw)] attribute even after Swift 6 is released.
Not sure. Needs more research.
Swift 6 will introduce a "typed throws" feature https://github.com/swiftlang/swift-evolution/blob/c0576bc0e479efabc97904020def8a8601939687/proposals/0413-typed-throws.md
Give the following bridge module:
We should emit a typed throw for Rust functions that return a Result.
We can add a
#[swift_bridge(typed_throw)]
attribute that allows people to use this in the0.1.x
branch, then remove the attribute once Swift 6 is the lowest Swift version supported by our "Minimum Supported Swift Version` policy #288The text was updated successfully, but these errors were encountered: