Skip to content

Conversation

@jckarter
Copy link
Contributor

If an expression refers to noncopyable storage, then default to performing a borrowing switch, where let bindings in patterns borrow out of the matched value. If an expression refers to a temporary value or explicitly uses the consume keyword, then perform a consuming switch, where let bindings take ownership of corresponding parts of the matched value. Allow _borrowing to still be used to explicitly bind a pattern variable as a borrow, with no-implicit-copy semantics for copyable values.

@jckarter jckarter requested review from a team, hborla, kavon, slavapestov and xedin as code owners March 28, 2024 01:20
@jckarter
Copy link
Contributor Author

@swift-ci Please test

If an expression refers to noncopyable storage, then default to performing
a borrowing switch, where `let` bindings in patterns borrow out of the
matched value. If an expression refers to a temporary value or explicitly
uses the `consume` keyword, then perform a consuming switch, where
`let` bindings take ownership of corresponding parts of the matched value.
Allow `_borrowing` to still be used to explicitly bind a pattern variable
as a borrow, with no-implicit-copy semantics for copyable values.
@jckarter jckarter force-pushed the borrowing-switch-expr-based-ownership branch from f613db4 to ba34948 Compare March 28, 2024 15:32
@jckarter
Copy link
Contributor Author

@swift-ci Please test

Copy link
Member

@kavon kavon left a comment

Choose a reason for hiding this comment

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

👍🏼 LGTM

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.

2 participants