-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[6.2] [nonescapable] remove '@_lifetime' requirement on implicit accessors #82407
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci test |
@swift-ci test macOS |
meg-gupta
approved these changes
Jun 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Do not eliminate a mark_dependence on a begin_apply scope even though the token has a trivial type. Ideally, token would have a non-trivial Builtin type to avoid special cases. (only relevant on 6.2)
Extract the special pattern matching logic that is otherwise unrelated to the check() function. This makes it obvious that the implementation was failing to set the 'changed' flag whenever needed. (cherry picked from commit c41715c)
Handle the presence of mark_dependence instructions after a begin_apply. Fixes a compiler crash: "copy of noncopyable typed value. This is a compiler bug. ..." (cherry picked from commit 7a29d9d)
06c9e6d
to
a5b0987
Compare
@swift-ci test |
tbkka
approved these changes
Jun 24, 2025
This avoids diagnostic errors on synthesized accessors, which are impossible for developers to understand. Fixes rdar://153793344 (Lifetime-dependent value returned by generated accessor '_read') (cherry picked from commit 855b3e4)
a5b0987
to
d3002ed
Compare
@swift-ci test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix SILCombine of MarkDependenceInst.
Do not eliminate a mark_dependence on a begin_apply scope even though the token
has a trivial type.
Ideally, token would have a non-trivial Builtin type to avoid special cases.
(only relevant on 6.2)
Fix MoveOnlyObjectCheckerPImpl::check() changed flag
Extract the special pattern matching logic that is otherwise unrelated to the
check() function. This makes it obvious that the implementation was failing to
set the 'changed' flag whenever needed.
(cherry picked from commit c41715c)
Fix MoveOnlyObjectCheckerPImpl::check() for mark_dependence.
Handle the presence of mark_dependence instructions after a begin_apply.
Fixes a compiler crash:
"copy of noncopyable typed value. This is a compiler bug. ..."
(cherry picked from commit 7a29d9d)
[nonescapable] remove '@_lifetime' requirement on implicit accessors
This avoids diagnostic errors on synthesized accessors, which are impossible for developers to understand.
Fixes rdar://153793344 (Lifetime-dependent value returned by generated accessor '_read')
(cherry picked from commit 855b3e4)
--- CCC ---
Explanation: Fix lifetime inference for synthesized accessors. Otherwise the diagnostics not actionable because they don't point to real source locations. It is always safe to infer for synthesized code because the compiler knows what is being generated. Tangentially, fix a potential miscompile in instruction simplification and frequent compiler crash in the move checker that were blocking this fix.
Scope: Affects most users of the supported Lifetimes feature when combining ~Copyable with ~Escapable types.
Radar/SR Issue: rdar://153793344 (Lifetime-dependent value returned by generated accessor '_read')
main PR: #82404
Risk: Low
a simple optimization is disabled under a very specific condition that only applies to non-escapable types.
the move checker now handles the presence of a mark_dependence instruction where previously it would always crash in that case. This is only expected to occur with non-escapable types.
lifetime diagnostics now handle synthesized accessors which developers are unaware of. This only loosens diagnostics to accept more cases that the compiler itself generates, not user code.
Testing: Added source and SIL unit tests
Reviewer: Meghana Gupta