Skip to content

5.9: [TypeLowering] Move-only types are lexical. #66717

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

Conversation

nate-chandler
Copy link
Contributor

Description: Fix TypeLowering of move-only types to have the lexical bit set.

Whether a value gets a lexical lifetime is deterimined by a few factors, among them, whether the type is lexical--to a first level of approximation, whether the type has any non-trivial fields that aren't explicity eager-move. Move-only types already have the non-trivial bit set. They need also to have the lexical bit set.
Risk: Low. The fix is very simple, two lines of code, just setting the lexical bits on move-only types.
Scope: Narrow. This only affects move-only types.
Original PR: #66705
Reviewed By: Andrew Trick ( @atrick )
Testing: Added test case illustrating that a move-only type is lexical.
Resolves: rdar://110901430

Vars of such types should be given lexical `alloc_stack`s by
`AllocBoxToStack` which requires that the `alloc_box` insts formed for
them have an associated borrow scope which in turn requires that type
lowering for move only structs and enums have their lexical bits set.

rdar://110901430
@nate-chandler nate-chandler requested a review from a team as a code owner June 16, 2023 20:41
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler requested review from atrick and tbkka June 16, 2023 20:42
@nate-chandler
Copy link
Contributor Author

Added NFC commit from main that prints out the fields in TypeLowering that were previously omitted (and which the test here is checking).

@nate-chandler
Copy link
Contributor Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit 39f1001 into swiftlang:release/5.9 Jun 17, 2023
@nate-chandler nate-chandler deleted the cherrypick/release/5.9/rdar110901430 branch July 5, 2023 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants