Skip to content

Commit d2d4f6b

Browse files
committed
Move the @unsafe for unsafe conformances to where @unchecked is for Sendable
Thank you for the suggestion, Xiaodi!
1 parent d1b1b1c commit d2d4f6b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

proposals/nnnn-strict-memory-safety.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,16 @@ extension ConformsToP: P {
282282
}
283283
```
284284

285-
To suppress this warning, one can place `@unsafe` on the extension (or type) where the conformance to `P` is supplied. This notes that the conformance itself is unsafe:
285+
To suppress this warning, one can place `@unsafe` on the conformance to `P` is supplied. This notes that the conformance itself is unsafe:
286286

287287
```swift
288-
@unsafe
289-
extension ConformsToP: P {
288+
extension ConformsToP: @unsafe P {
290289
@unsafe func f() { }
291290
}
292291
```
293292

293+
Use of an `@unsafe` conformance for any reason (e.g., when that conformance is needed to call a generic function with a `ConformsToP` requirement) is diagnosed as an unsafe use, much like use of an `@unsafe` declaration.
294+
294295
### Strict safety mode and escalatable warnings
295296

296297
The strict memory safety mode can be enabled with the new compiler flag `-strict-memory-safety`.

0 commit comments

Comments
 (0)