Skip to content

Commit c15279c

Browse files
authored
Add Minimum Supported Swift Version Policy (#316)
This commit introduces a "Minimum Supported Swift Version" policy to help users understand whether their code is guaranteed to work on a particular version of Swift. As a starting point, we are supporting Swift 6.0+ . Starting at `6.0` allows us to begin leveraging Swift's new ownership features in order to automatically enforce certain safety requirements. See the `Safety` chapter in the internal book for more information about safety requirements that, by leveraging Swift 6.0, we will be able to automatically enforce.
1 parent a661800 commit c15279c

26 files changed

+43
-24
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,25 @@ to see if any peak your interest.
164164

165165
These issues come with step-by-step instructions that should help guide you towards implementing your first patch.
166166

167+
## Minimum Supported Swift Version (MSSV)
168+
169+
`swift-bridge` currently guarantees that the Swift code that it generates will work on Swift `6.0` and later.
170+
This is known the project's "Minimum Supported Swift Version" (MSSV).
171+
172+
`swift-bridge`'s current policy is that the minimum required Swift version can be increased at any time to
173+
any Swift version that is at least one month old.
174+
175+
For instance, if Swift `9.10.11` is released on April 5, 2035, then on May 5, 2035 the `swift-bridge` project is allowed
176+
to begin emitting Swift code that relies on Swift `9.10.11`.
177+
178+
We will increase our support windows when one or both of the following happen:
179+
180+
- We are no longer waiting for Swift features that increase the safety, performance and ergonomics of the Swift code that `swift-bridge` emits.
181+
- For instance, Swift recently introduced the `~Copyable` protocol, which we plan to use enforce ownership when Swift code uses opaque Rust types.
182+
183+
- The short support window is disrupting projects that use `swift-bridge` today.
184+
- Please open an issue if our MSSV policy impacts your project
185+
167186
## Acknowledgements
168187

169188
- [cxx](https://github.com/dtolnay/cxx) inspired the idea of using a bridge module to describe the FFI boundary.

crates/swift-bridge-ir/src/codegen/codegen_tests.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ use crate::test_utils::{
2727
assert_trimmed_generated_equals_trimmed_expected, parse_ok,
2828
};
2929

30-
mod already_declared_attribute_codegen_tests;
31-
mod argument_label_codegen_tests;
32-
mod async_function_codegen_tests;
33-
mod boxed_fnonce_codegen_tests;
34-
mod built_in_tuple_codegen_tests;
35-
mod c_header_declaration_order_codegen_tests;
36-
mod conditional_compilation_codegen_tests;
37-
mod derive_attribute_codegen_tests;
38-
mod derive_struct_attribute_codegen_tests;
39-
mod extern_rust_function_opaque_rust_type_argument_codegen_tests;
40-
mod extern_rust_function_opaque_rust_type_return_codegen_tests;
41-
mod extern_rust_method_swift_class_placement_codegen_tests;
42-
mod function_attribute_codegen_tests;
43-
mod generic_opaque_rust_type_codegen_tests;
44-
mod opaque_rust_type_codegen_tests;
45-
mod opaque_swift_type_codegen_tests;
46-
mod option_codegen_tests;
47-
mod result_codegen_tests;
48-
mod return_into_attribute_codegen_tests;
49-
mod single_representation_type_elision_codegen_tests;
50-
mod string_codegen_tests;
51-
mod transparent_enum_codegen_tests;
52-
mod transparent_struct_codegen_tests;
53-
mod vec_codegen_tests;
30+
mod already_declared_attribute;
31+
mod argument_label;
32+
mod async_function;
33+
mod boxed_fnonce;
34+
mod built_in_tuple;
35+
mod c_header_declaration_order;
36+
mod conditional_compilation;
37+
mod derive_attribute;
38+
mod derive_struct_attribute;
39+
mod extern_rust_function_opaque_rust_type_argument;
40+
mod extern_rust_function_opaque_rust_type_return;
41+
mod extern_rust_method_swift_class_placement;
42+
mod function_attribute;
43+
mod generic_opaque_rust_type;
44+
mod opaque_rust_type;
45+
mod opaque_swift_type;
46+
mod option;
47+
mod result;
48+
mod return_into_attribute;
49+
mod single_representation_type_elision;
50+
mod string;
51+
mod transparent_enum;
52+
mod transparent_struct;
53+
mod vec;
5454

5555
struct CodegenTest {
5656
bridge_module: BridgeModule,

0 commit comments

Comments
 (0)