-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] API additions for basic noncopyable primitives #73807
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
[stdlib] API additions for basic noncopyable primitives #73807
Conversation
@swift-ci test |
@swift-ci test source compatibility |
@swift-ci build toolchain |
@swift-ci test |
This comment was marked as outdated.
This comment was marked as outdated.
@swift-ci test source compatibility |
@swift-ci build toolchain |
fc1ddd2
to
3df540d
Compare
3df540d
to
c75ad47
Compare
@swift-ci test |
Builtin.initialize(tmp, p2) | ||
let temp = consume a | ||
a = consume b | ||
b = consume temp |
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.
🎉
@@ -232,7 +232,7 @@ extension Optional where Wrapped: ~Copyable { | |||
) throws(E) -> U? { | |||
#if compiler(>=6.0) && $NoncopyableGenerics | |||
switch self { | |||
case .some(_borrowing y): | |||
case .some(let y): |
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.
I'm assuming these changes are in reaction to warnings about _borrowing
being deprecated. I had to change these to use the deprecated spellings intentionally in order to ensure that the standard library's .swiftinterface
is still buildable with the older compiler versions that we support. Until we drop support for those older compiler versions these warnings cannot be addressed I'm afraid.
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.
Local testing on release/6.0 indicates we're good -- those old compilers appear to accept this PR (or rather, the sibling PR #73810) as is, with no changes. Switching back from _borrowing
to let
may actually be working in our favor here. Lucky escape!
- Add `exchange(_:with:)` - Add `Optional.take()` - Add `Unsafe[Mutable]BufferPointer.extracting(_:)` - Finish generalizing `withExtendedLifetime` - Radically simplify the implementation of `swap(_:_:)`
c75ad47
to
f2dc894
Compare
@swift-ci test |
@swift-ci build toolchain |
@swift-ci test source compatibility |
All known issues have been addressed. This is technically ready to merge pending favorable CI outcome. However, the PR includes a couple of tiny amendments to SE-0437; I'm temporarily holding off from landing this until the LSG has had a chance to discuss swiftlang/swift-evolution#2489. |
I keep forgetting that `some RangeExpression<Element>` does not cover the `UnboundedRange` form.
273949f
to
9d947e4
Compare
@swift-ci test |
@swift-ci build toolchain |
@swift-ci test source compatibility |
Some of the toolchains builds will fail as #74486 has not landed yet. |
This PR implements the stdlib API additions introduced by SE-0437:
exchange(_:with:)
Optional.take()
Unsafe[Mutable]BufferPointer.extracting(_:)
withExtendedLifetime
swap(_:_:)