Skip to content

Commit f9f9f1c

Browse files
Xazax-hunGabor Horvathheckj
authored
[cxx-interop] Document some caveats of safe interop (#1094)
Some of these like the compiler flag to enable the safe wrappers is not documented anywhere. Having this documentation in place can help more people to play around with the feature and report bugs. Co-authored-by: Gabor Horvath <[email protected]> Co-authored-by: Joseph Heck <[email protected]>
1 parent d8a8c59 commit f9f9f1c

File tree

1 file changed

+11
-0
lines changed
  • documentation/cxx-interop/safe-interop

1 file changed

+11
-0
lines changed

documentation/cxx-interop/safe-interop/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ struct SWIFT_NONESCAPABLE StringRef { ... };
105105
Now the Swift compiler imports `StringRef` as a safe type and no longer
106106
emits a warning about using an unsafe type.
107107
108+
<div class="info" markdown="1">
109+
Some containers and protocols do not yet support non-escapable types in Swift 6.2.
110+
</div>
111+
108112
### Annotating C++ APIs
109113
110114
Building the code again will emit a new diagnostic for the `fileName` function about
@@ -394,6 +398,13 @@ adding additional annotations to C or C++ APIs will not affect Swift code curren
394398
relying on the plain interface. Adding additional information may alter the signature
395399
of any existing safe overload however, since only 1 safe overload per imported function is generated.
396400

401+
<div class="info" markdown="1">
402+
At the time of writing, the features described in this section
403+
are behind an experimental feature flag on the Swift 6.2 release branch.
404+
To enable these features, pass `-enable-experimental-feature SafeInteropWrappers`
405+
to the Swift compiler.
406+
</div>
407+
397408
### Safe Overloads for C++ `std::span`
398409

399410
APIs taking or returning C++'s `std::span` with sufficient lifetime

0 commit comments

Comments
 (0)