Skip to content

Fix a move-checker diagnostic message (textual change) #82862

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
Jul 8, 2025

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jul 8, 2025

The move-checker was assuming that any non-Copyable variable in a box must be
captured by a closure. The underlying problem is that the move-checker relies on
the best-effort AllocBoxToStack optimization to be perfect. But when
non-Escapable values depend on the variable, it remains boxed. That's good for
lifetime diagnostics but caused an incorrect move-checker diagnostic.

Fixes rdar://154519148 (Returning non-copyable type after accessing borrowed
field emits incorrect error about escaped closure capturing the noncopyable)

The move-checker was assuming that any non-Copyable variable in a box must be
captured by a closure. The underlying problem is that the move-checker relies on
the best-effort AllocBoxToStack optimization to be perfect. But when
non-Escapable values depend on the variable, it remains boxed. That's good for
lifetime diagnostics but caused an incorrect move-checker diagnostic.

Fixes rdar://154519148 (Returning non-copyable type after accessing borrowed
field emits incorrect error about escaped closure capturing the noncopyable)
@atrick
Copy link
Contributor Author

atrick commented Jul 8, 2025

@swift-ci smoke test

@atrick atrick merged commit f3557fe into swiftlang:main Jul 8, 2025
3 checks passed
@atrick atrick deleted the moveonly-diag branch July 8, 2025 15:16
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.

1 participant