Skip to content

Update SwiftCompilerSources AllocBoxToStack to handle mark_dep. #82853

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jul 7, 2025

  • Fix AllocBoxToStack to handle mark_dependence[_addr]
    Handle the easy case in which the promoted box is the base operand of a
    mark_dep. This requires nothing more than setting the base operand to the new
    stack address.

    Required for move-only checking. Otherwise, we get an incredibly bizarre
    compiler error: noncopyable 'foo' cannot be consumed when captured by an
    escaping closure

    Fixes rdar://150398673 ([nonescapable] allocbox-to-stack fails causing lifetime diagnostics to fail)

  • Update SwiftCompilerSources AllocBoxToStack to handle mark_dep.
    Handle the easy case in which the promoted box is the base operand of a
    mark_dep. This requires nothing more than setting the base operand to the new
    stack address.

    Required for move-only checking. Otherwise, we get an incredibly bizarre
    compiler error: noncopyable 'foo' cannot be consumed when captured by an
    escaping closure

    The legacy pass was updated first for 6.2.

@atrick atrick requested review from eeckstein and jckarter as code owners July 7, 2025 21:07
@atrick atrick marked this pull request as draft July 7, 2025 23:43
@atrick
Copy link
Contributor Author

atrick commented Jul 7, 2025

This is updated from Meghana's PR
#81638

@atrick
Copy link
Contributor Author

atrick commented Jul 7, 2025

I'm not merging this until I figure out what strategy to pursue for the 6.2 branch

@atrick atrick requested a review from meg-gupta July 7, 2025 23:45
Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

atrick added 4 commits July 9, 2025 10:01
Handle the easy case in which the promoted box is the base operand of a
mark_dep. This requires nothing more than setting the base operand to the new
stack address.

Required for move-only checking. Otherwise, we get an incredibly bizarre
compiler error: noncopyable 'foo' cannot be consumed when captured by an
escaping closure

Fixes rdar://150398673 ([nonescapable] allocbox-to-stack fails causing
lifetime diagnostics to fail)
Handle the easy case in which the promoted box is the base operand of a
mark_dep. This requires nothing more than setting the base operand to the new
stack address.

Required for move-only checking. Otherwise, we get an incredibly bizarre
compiler error: noncopyable 'foo' cannot be consumed when captured by an
escaping closure

The legacy pass was updated first for 6.2.
Make the actual errors more obvious in the trace output since diagnostics
messages are not printed in-line with tracing.
@atrick atrick force-pushed the boxtostack-markdep branch from 0c7ad76 to a281754 Compare July 9, 2025 22:50
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