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
Acknowledge unsafe API usages in code expanded from testing library macros (#1134)
Acknowledge unsafe API usages from various testing library macros such
as `@Test`, `@Suite`, and `#expect(processExitsWith:)` which are
revealed in modules which enable the new opt-in strict memory safety
feature in Swift 6.2.
### Motivation:
This fix allows clients of the testing library to enable [SE-0458:
Opt-in Strict Memory Safety
Checking](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0458-strict-memory-safety.md)
if they wish and avoid diagnostics from the testing library macros in
their modules. These warnings generally looked like this, before this
fix:
```
⚠️ @__swiftmacro_22MemorySafeTestingTests19exampleTestFunction33_F2EA1AA3013574E5644E5A4339F05086LL0F0fMp_.swift:23:14: warning: expression uses unsafe constructs but is not marked with 'unsafe'
Testing.Test.__store($s22MemorySafeTestingTests19exampleTestFunction33_F2EA1AA3013574E5644E5A4339F05086LL0F0fMp_25generator1e3470c498e8fe35fMu_, into: outValue, asTypeAt: type)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
### Modifications:
- Add test file to reproduce the new diagnostics. It's in a new module
which opts-in to strict memory safety, and marked as a dependency of
`TestingTests`.
- Add `unsafe` keyword in the appropriate places in our macros to
acknowledge the existing unsafe usages.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
Fixes: rdar://151238560
0 commit comments