Skip to content

Conversation

@DougGregor
Copy link
Member

  • Explanation: Fix a number of issues related to strict memory safety's handling of safe types nested within unsafe ones, eliminating a class of false positives observed in the adoption of strict memory safety. Previously, we would effectively consider the safe nested type as unsafe if its outer type was unsafe. Model them more independently.
  • Scope: Affects diagnostics under the strict memory safety mode introduced by SE-0458.
  • Issues: rdar://149628760
  • Original PRs: [Strict memory safety] Improve handling of safe types nested within unsafe ones #80933
  • Risk: Low. Only affects opt-in diagnostics that are warnings.
  • Testing: New tests, updated standard library

Typealiases involving unsafe types that resolve to safe types
should not be diagnosed.

(cherry picked from commit 0405f61)
…rd libraries

Now that we aren't propagating "unsafe" to nested types, remove
unnecessary "unsafe" keywords from the standard library.

(cherry picked from commit fe68567)
…eir enclosing type

When determining whether a nested type is safe, don't consider whether
its enclosing type is safe. They're independent.

(cherry picked from commit 8ec52c8)
… types

Use this to mark a few internal types @safe now that it works properly.

(cherry picked from commit 457eb4c)
…as implicitly 'unsafe'

This eliminates stray warnings.

(cherry picked from commit b7d41a5)
@DougGregor DougGregor requested a review from a team as a code owner April 21, 2025 16:08
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor enabled auto-merge April 21, 2025 18:11
@DougGregor DougGregor merged commit 28d2bef into swiftlang:release/6.2 Apr 22, 2025
5 checks passed
@DougGregor DougGregor deleted the safe-nested-in-unsafe-fixes-6.2 branch April 22, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants