Skip to content

Commit bb13553

Browse files
authored
Merge pull request #2228 from jcavar/patch-1
Rename to consuming parameter modifier
2 parents 50567cc + 3428f27 commit bb13553

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

proposals/0366-move-function.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ func test() {
124124

125125
The `consume x` operator syntax deliberately mirrors the
126126
proposed [ownership modifier](https://forums.swift.org/t/borrow-and-take-parameter-ownership-modifiers/59581)
127-
parameter syntax, `(x: consume T)`, because the caller-side behavior of `consume`
128-
operator is analogous to a callee’s behavior receiving a `consume` parameter.
127+
parameter syntax, `(x: consuming T)`, because the caller-side behavior of `consume`
128+
operator is analogous to a callee’s behavior receiving a `consuming` parameter.
129129
`doStuffUniquely(with:)` can use the `consume` operator, combined with
130-
the `consume` parameter modifier, to preserve the uniqueness of the parameter
130+
the `consuming` parameter modifier, to preserve the uniqueness of the parameter
131131
as it moves it into its own local variable for mutation:
132132

133133
```swift
134-
func doStuffUniquely(with value: consume [Int]) {
134+
func doStuffUniquely(with value: consuming [Int]) {
135135
// If we received the last remaining reference to `value`, we'd like
136136
// to be able to efficiently update it without incurring more copies.
137137
var newValue = consume value
@@ -173,7 +173,7 @@ of `doStuffUniquely` after being consumed to initialize `newValue`, they will
173173
get an error:
174174

175175
```swift
176-
func doStuffUniquely(with value: consume [Int]) {
176+
func doStuffUniquely(with value: consuming [Int]) {
177177
// If we received the last remaining reference to `value`, we'd like
178178
// to be able to efficiently update it without incurring more copies.
179179
var newValue = consume value

0 commit comments

Comments
 (0)