Skip to content

Conversation

@jamieQ
Copy link
Contributor

@jamieQ jamieQ commented Aug 4, 2025

Explanation:
Updates ConsumeOperatorCopyableValuesChecker to identify store_borrow instructions as a liveness-affecting use so that patterns that would previously slip through undiagnosed are correctly identified

Scope:

  • addresses a regression with use-after-consume diagnostics
  • diagnostic pass handles more cases, so could plausibly break code that used to compile

Issues:

Original PRs:

Risk:

  • Low. The patch only affects consume-checking of copyable values. Furthermore, it only increases the strictness of that checking, so it shouldn't cause any previously diagnosed code to go undiagnosed.

Testing:

  • new unit tests added

Reviewers:

Updates ConsumeOperatorCopyableValuesChecker to identify store_borrow
instructions as a liveness-affecting use so that patterns that would
previously slip through undiagnosed are correctly identified. e.g.

```swift
func use<V>(_ v: borrowing V) {}

func f() {
  let a = A()
  _ = consume a
  use(a) // previously would not be diagnosed
}
```

(cherry picked from commit 754a300)
@jamieQ jamieQ requested a review from a team as a code owner August 4, 2025 17:40
@jamieQ
Copy link
Contributor Author

jamieQ commented Aug 4, 2025

@swift-ci please smoke test

@jamieQ
Copy link
Contributor Author

jamieQ commented Aug 4, 2025

@nate-chandler could you please let me know your assessment of the 'risk' of this change (and feel free to just edit the description if that's possible)?

@nate-chandler
Copy link
Contributor

@jamieQ certainly! This is a low risk change. It only affects consume checking of copyable values. It only increases the strictness of that checking, so it shouldn't cause any previously diagnosed code to go undiagnosed.

@jamieQ
Copy link
Contributor Author

jamieQ commented Aug 4, 2025

@DougGregor FYI as release manager

@jamieQ
Copy link
Contributor Author

jamieQ commented Aug 5, 2025

@swift-ci please test linux platform

@jamieQ
Copy link
Contributor Author

jamieQ commented Aug 5, 2025

@swift-ci please test macos platform

@nate-chandler nate-chandler merged commit 2f34d0a into swiftlang:release/6.2 Aug 14, 2025
5 checks passed
@jamieQ jamieQ deleted the release/6.2 branch August 14, 2025 01:58
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.

3 participants