From 469c9cf3d412595ec10f1f665fe326c3fc1a6370 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Mon, 23 Jun 2025 16:43:32 +0200 Subject: [PATCH] [cxx-interop] Document some caveats of safe interop 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. --- documentation/cxx-interop/safe-interop/index.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/documentation/cxx-interop/safe-interop/index.md b/documentation/cxx-interop/safe-interop/index.md index 906a68efd..a4e86759a 100644 --- a/documentation/cxx-interop/safe-interop/index.md +++ b/documentation/cxx-interop/safe-interop/index.md @@ -105,6 +105,10 @@ struct SWIFT_NONESCAPABLE StringRef { ... }; Now the Swift compiler imports `StringRef` as a safe type and no longer emits a warning about using an unsafe type. +
+Some containers and protocols do not yet support non-escapable types in Swift 6.2. +
+ ### Annotating C++ APIs Building the code again will emit a new diagnostic for the `fileName` function about @@ -387,6 +391,13 @@ compiler can bridge those span-like parameters to Swift's and [`MutableSpan`](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0467-MutableSpan.md) types, and the user with a safe and convenient interface to those imported APIs. +
+At the time of writing, the features described in this section +are behind an experimental feature flag on the Swift 6.2 release branch. +To enable these features, pass `-enable-experimental-feature SafeInteropWrappers` +to the Swift compiler. +
+ ### C++ `std::span` Support APIs taking or returning C++'s `std::span` with sufficient lifetime