Skip to content

[5.9][Release Notes] Issue #64927: Constrain implicit raw pointer #64929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ _**Note:** This is in reverse chronological order, so newer entries are added to

## Swift 5.9

* [#64927][]:

Swift 5.9 introduces warnings that catch conversions from an inout
argument in the caller to an `UnsafeRawPointer` in the callee
whenever the original type contains an object reference.

```swift
func inspectString(string: inout String) {
readBytes(&string)
// warning: forming an 'UnsafeRawPointer' to an inout variable of type String
// exposes the internal representation rather than the string contents.
}
```

```swift
func inspectData(data: inout Data) {
readBytes(&data)
// warning: forming an 'UnsafeRawPointer' to a variable of type 'T';
// this is likely incorrect because 'T' may contain an object reference.
}
```

Please see the "Workarounds for common cases" section link in github
issue #64927.

* Marking stored properties as unavailable with `@available` has been banned,
closing an unintentional soundness hole that had allowed arbitrary
unavailable code to run and unavailable type metadata to be used at runtime:
Expand Down Expand Up @@ -9705,6 +9730,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
[SE-0376]: <https://github.com/apple/swift-evolution/blob/main/proposals/0376-function-back-deployment.md>
[SE-0377]: <https://github.com/apple/swift-evolution/blob/main/proposals/0377-parameter-ownership-modifiers.md>

[#64927]: <https://github.com/apple/swift/issues/64927>
[#42697]: <https://github.com/apple/swift/issues/42697>
[#42728]: <https://github.com/apple/swift/issues/42728>
[#43036]: <https://github.com/apple/swift/issues/43036>
Expand Down