Skip to content

Commit 998759d

Browse files
committed
[Release Notes] Issue #64927: Constrain implicit raw pointer
conversion to bitwise-copyable values
1 parent 303fc14 commit 998759d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
44

55
## Swift 5.9
66

7+
* [#64927][]:
8+
9+
Swift 5.9 introduces warnings that catch conversions from an inout
10+
argument in the caller to an `UnsafeRawPointer` in the callee
11+
whenever the original type contains an object reference.
12+
13+
```swift
14+
func inspectString(string: inout String) {
15+
readBytes(&string)
16+
// warning: forming an 'UnsafeRawPointer' to an inout variable of type String
17+
// exposes the internal representation rather than the string contents.
18+
}
19+
```
20+
21+
```swift
22+
func inspectData(data: inout Data) {
23+
readBytes(&data)
24+
// warning: forming an 'UnsafeRawPointer' to a variable of type 'T';
25+
// this is likely incorrect because 'T' may contain an object reference.
26+
}
27+
```
28+
29+
Please see the "Workarounds for common cases" section link in this github issue.
30+
731
* [SE-0366][]:
832

933
The lifetime of a local variable value can be explicitly ended using the
@@ -9683,6 +9707,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
96839707
[SE-0376]: <https://github.com/apple/swift-evolution/blob/main/proposals/0376-function-back-deployment.md>
96849708
[SE-0377]: <https://github.com/apple/swift-evolution/blob/main/proposals/0377-parameter-ownership-modifiers.md>
96859709

9710+
[#64927]: <https://github.com/apple/swift/issues/64927>
96869711
[#42697]: <https://github.com/apple/swift/issues/42697>
96879712
[#42728]: <https://github.com/apple/swift/issues/42728>
96889713
[#43036]: <https://github.com/apple/swift/issues/43036>

0 commit comments

Comments
 (0)