Skip to content

[nonescapable] remove '@_lifetime' requirement on implicit accessors #82404

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 4 commits into from
Jun 23, 2025

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jun 23, 2025

And assorted tangential fixes for potential miscompiles and compiler crashes...

  • 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.

  • 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. ..."

  • Fix MarkDependenceInst.simplify()
    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.

  • Add lifetime dependence unit tests for syntesized accessors.

  • [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')

atrick added 2 commits June 22, 2025 16:38
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.
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. ..."
@atrick
Copy link
Contributor Author

atrick commented Jun 23, 2025

@swift-ci test

@atrick atrick force-pushed the fix-accessor-infer branch from 2162fde to 11721ef Compare June 23, 2025 06:22
@atrick
Copy link
Contributor Author

atrick commented Jun 23, 2025

@swift-ci test

@atrick atrick enabled auto-merge June 23, 2025 06:22
atrick added 2 commits June 22, 2025 23:25
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.
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')
@atrick atrick force-pushed the fix-accessor-infer branch from 11721ef to 855b3e4 Compare June 23, 2025 06:27
@atrick
Copy link
Contributor Author

atrick commented Jun 23, 2025

@swift-ci test

@atrick atrick merged commit 97ddc4e into swiftlang:main Jun 23, 2025
4 of 5 checks passed
@atrick atrick deleted the fix-accessor-infer branch June 23, 2025 15:07
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