swift-evolution/0366-move-function.md at main · apple/swift-evolution.
This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. - swift-evolution/0366-move-function.md at main · apple/swift-evolution
Read in full here:
This file has been truncated.
# Move Function + "Use After Move" Diagnostic
* Proposal: [SE-0366](0366-move-function.md)
* Authors: [Michael Gottesman](https://github.com/gottesmm), [Andrew Trick](https://github.com/atrick), [Joe Groff](https://github.com/jckarter)
* Review Manager: [Holly Borla](https://github.com/hborla)
* Status: **Active Review (July 25...August 8, 2022)**
* Implementation: Implemented on main as stdlib SPI (`_move` instead of `move`)
* Review: ([pitch](https://forums.swift.org/t/pitch-move-function-use-after-move-diagnostic)) ([review](https://forums.swift.org/t/se-0366-move-function-use-after-move-diagnostic/59202))
In this document, we propose adding a new function called `move` to the swift
standard library, which ends the lifetime of a specific local `let`,
local `var`, or `consuming` function parameter, and which enforces this
by causing the compiler to emit a diagnostic upon any uses that are after the
move function. This allows for code that relies on **forwarding ownership**
of values for performance or correctness to communicate that requirement to
the compiler and to human readers. As an example:
This thread was posted by one of our members via one of our news source trackers.
Corresponding tweet for this thread:
Share link for this tweet.