|
3 | 3 | > [!NOTE]
|
4 | 4 | > This is in reverse chronological order, so newer entries are added to the top.
|
5 | 5 |
|
| 6 | +## Swift 6.2 |
| 7 | + |
| 8 | +* [SE-0458][]: |
| 9 | + Introduced an opt-in mode for strict checking of memory safety, which can be |
| 10 | + enabled with the compiler flag `-strict-memory-safety`. In this mode, |
| 11 | + the Swift compiler will produce warnings for uses of memory-unsafe constructs |
| 12 | + and APIs. For example, |
| 13 | + |
| 14 | + ```swift |
| 15 | + func evilMalloc(size: Int) -> Int { |
| 16 | + // warning: call to global function 'malloc' involves unsafe type 'UnsafeMutableRawPointer' |
| 17 | + return Int(bitPattern: malloc(size)) |
| 18 | + } |
| 19 | + ``` |
| 20 | + |
| 21 | + These warnings are in their own diagnostic group (`Unsafe`) and can |
| 22 | + be suppressed by ackwnowledging the memory-unsafe behavior, for |
| 23 | + example with an `unsafe` expression: |
| 24 | + |
| 25 | + ```swift |
| 26 | + func evilMalloc(size: Int) -> Int { |
| 27 | + return unsafe Int(bitPattern: malloc(size)) // no warning |
| 28 | + } |
| 29 | + ``` |
| 30 | + |
6 | 31 | ## Swift 6.1
|
7 | 32 |
|
8 | 33 | * Previous versions of Swift would incorrectly allow Objective-C `-init...`
|
@@ -10676,6 +10701,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
|
10676 | 10701 | [SE-0431]: https://github.com/apple/swift-evolution/blob/main/proposals/0431-isolated-any-functions.md
|
10677 | 10702 | [SE-0442]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0442-allow-taskgroup-childtaskresult-type-to-be-inferred.md
|
10678 | 10703 | [SE-0444]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
|
| 10704 | +[SE-0458]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0458-strict-memory-safety.md |
10679 | 10705 | [#64927]: <https://github.com/apple/swift/issues/64927>
|
10680 | 10706 | [#42697]: <https://github.com/apple/swift/issues/42697>
|
10681 | 10707 | [#42728]: <https://github.com/apple/swift/issues/42728>
|
|
0 commit comments