@@ -3143,11 +3143,11 @@ func closureLetStoreClosureInVariableIsEscape() {
31433143
31443144 let f = {
31453145 borrowVal ( s)
3146- consumeVal ( s) // expected-error {{captured 's' cannot be consumed within a closure}}
3146+ consumeVal ( s) // expected-error {{noncopyable 's' cannot be consumed when captured by a closure}}
31473147 }
31483148 let c = StoreClosure ( f: f)
31493149 _ = c
3150- consumeVal ( s) // expected-error {{captured 's' cannot be consumed within a closure}}
3150+ consumeVal ( s) // expected-error {{noncopyable 's' cannot be consumed when captured by a closure}}
31513151}
31523152
31533153/////////////////////////////
@@ -3202,8 +3202,8 @@ public func closureVarCaptureClassUseAfterConsume() {
32023202 var f = { }
32033203 f = {
32043204 borrowVal ( x2)
3205- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3206- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3205+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3206+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
32073207 }
32083208 f ( )
32093209}
@@ -3214,7 +3214,7 @@ public func closureVarCaptureClassUseAfterConsume2() {
32143214 var f = { }
32153215 f = {
32163216 borrowVal ( x2)
3217- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3217+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
32183218 }
32193219 f ( )
32203220}
@@ -3225,12 +3225,12 @@ public func closureVarCaptureClassUseAfterConsumeError() {
32253225 var f = { }
32263226 f = {
32273227 borrowVal ( x2)
3228- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3229- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3228+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3229+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
32303230 }
32313231 f ( )
3232- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3233- let x3 = x2 // expected-error {{captured 'x2' cannot be consumed within a closure}}
3232+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3233+ let x3 = x2 // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
32343234 x2 = Klass ( )
32353235 let _ = x3
32363236}
@@ -3458,7 +3458,7 @@ public func closureVarAndDeferCaptureClassUseAfterConsume2(_ x: borrowing Klass)
34583458 x2 = x // expected-note {{consuming use here}}
34593459 var f = { }
34603460 f = {
3461- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3461+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
34623462 defer {
34633463 borrowVal ( x2)
34643464 consumeVal ( x2) // expected-note {{consuming use here}}
@@ -3479,7 +3479,7 @@ public func closureVarAndDeferCaptureClassUseAfterConsume3(_ x: borrowing Klass)
34793479 // expected-note @-1 {{consuming use here}}
34803480 var f = { }
34813481 f = {
3482- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3482+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
34833483 defer {
34843484 borrowVal ( x2)
34853485 consumeVal ( x2) // expected-note {{consuming use here}}
@@ -3489,11 +3489,11 @@ public func closureVarAndDeferCaptureClassUseAfterConsume3(_ x: borrowing Klass)
34893489 print ( " foo " )
34903490 }
34913491 f ( )
3492- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3492+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
34933493}
34943494
34953495public func closureVarAndDeferCaptureClassArgUseAfterConsume( _ x2: borrowing Klass ) {
3496- // expected-error @-1 {{captured 'x2' cannot be consumed within a closure}}
3496+ // expected-error @-1 {{noncopyable 'x2' cannot be consumed when captured by a closure}}
34973497 // expected-error @-2 {{'x2' is borrowed and cannot be consumed by closure capture}}
34983498 var f = { }
34993499 f = { // expected-note {{closure capture here}}
@@ -3508,7 +3508,7 @@ public func closureVarAndDeferCaptureClassArgUseAfterConsume(_ x2: borrowing Kla
35083508}
35093509
35103510public func closureVarAndDeferCaptureClassOwnedArgUseAfterConsume( _ x2: __owned Klass) {
3511- // expected-error @-1 {{captured 'x2' cannot be consumed within a closure}}
3511+ // expected-error @-1 {{noncopyable 'x2' cannot be consumed when captured by a closure}}
35123512 var f = { }
35133513 f = {
35143514 defer {
@@ -3539,7 +3539,7 @@ public func closureVarAndDeferCaptureClassOwnedArgUseAfterConsume2(_ x2: consumi
35393539
35403540// TODO: MG
35413541public func closureVarAndDeferCaptureClassOwnedArgUseAfterConsume3( _ x2: __owned Klass) {
3542- // expected-error @-1 {{captured 'x2' cannot be consumed within a closure}}
3542+ // expected-error @-1 {{noncopyable 'x2' cannot be consumed when captured by a closure}}
35433543 var f = { }
35443544 f = {
35453545 defer {
@@ -3550,7 +3550,7 @@ public func closureVarAndDeferCaptureClassOwnedArgUseAfterConsume3(_ x2: __owned
35503550 print ( " foo " )
35513551 }
35523552 f ( )
3553- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3553+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
35543554}
35553555
35563556public func closureVarAndDeferCaptureClassOwnedArgUseAfterConsume4( _ x2: consuming Klass ) {
@@ -3567,7 +3567,7 @@ public func closureVarAndDeferCaptureClassOwnedArgUseAfterConsume4(_ x2: consumi
35673567 print ( " foo " )
35683568 }
35693569 f ( )
3570- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3570+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
35713571}
35723572
35733573///////////////////////////////////////////
@@ -3582,11 +3582,11 @@ public func closureVarAndClosureCaptureClassUseAfterConsume(_ x: borrowing Klass
35823582 var g = { }
35833583 g = {
35843584 borrowVal ( x2)
3585- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3586- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3585+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3586+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
35873587 }
35883588 g ( )
3589- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3589+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
35903590 }
35913591 f ( )
35923592}
@@ -3601,14 +3601,14 @@ public func closureVarAndClosureCaptureClassUseAfterConsume2(_ x: borrowing Klas
36013601 var g = { }
36023602 g = {
36033603 borrowVal ( x2)
3604- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3605- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3604+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3605+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36063606 }
36073607 g ( )
36083608 }
36093609 f ( )
3610- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3611- let x3 = x2 // expected-error {{captured 'x2' cannot be consumed within a closure}}
3610+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3611+ let x3 = x2 // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36123612 _ = x3
36133613}
36143614
@@ -3623,19 +3623,19 @@ public func closureVarAndClosureCaptureClassUseAfterConsume3(_ x: borrowing Klas
36233623 var g = { }
36243624 g = {
36253625 borrowVal ( x2)
3626- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3627- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3626+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3627+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36283628 }
36293629 g ( )
36303630 }
36313631 f ( )
3632- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3633- let x3 = x2 // expected-error {{captured 'x2' cannot be consumed within a closure}}
3632+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3633+ let x3 = x2 // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36343634 _ = x3
36353635}
36363636
36373637public func closureVarAndClosureCaptureClassArgUseAfterConsume( _ x2: borrowing Klass ) {
3638- // expected-error @-1 {{captured 'x2' cannot be consumed within a closure}}
3638+ // expected-error @-1 {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36393639 // expected-error @-2 {{'x2' is borrowed and cannot be consumed by closure capture}}
36403640 // expected-error @-3 {{'x2' is borrowed and cannot be consumed by closure capture}}
36413641 var f = { }
@@ -3657,8 +3657,8 @@ public func closureVarAndClosureCaptureClassOwnedArgUseAfterConsume(_ x2: __owne
36573657 var g = { }
36583658 g = {
36593659 borrowVal ( x2)
3660- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3661- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3660+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3661+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36623662 }
36633663 g ( )
36643664 }
@@ -3671,8 +3671,8 @@ public func closureVarAndClosureCaptureClassOwnedArgUseAfterConsume2(_ x2: consu
36713671 var g = { }
36723672 g = {
36733673 borrowVal ( x2)
3674- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3675- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3674+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3675+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36763676 }
36773677 g ( )
36783678 }
@@ -3685,13 +3685,13 @@ public func closureVarAndClosureCaptureClassOwnedArgUseAfterConsume3(_ x2: __own
36853685 var g = { }
36863686 g = {
36873687 borrowVal ( x2)
3688- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3689- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3688+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3689+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36903690 }
36913691 g ( )
36923692 }
36933693 f ( )
3694- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3694+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
36953695}
36963696
36973697public func closureVarAndClosureCaptureClassOwnedArgUseAfterConsume4( _ x2: consuming Klass ) {
@@ -3700,13 +3700,13 @@ public func closureVarAndClosureCaptureClassOwnedArgUseAfterConsume4(_ x2: consu
37003700 var g = { }
37013701 g = {
37023702 borrowVal ( x2)
3703- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3704- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3703+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
3704+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
37053705 }
37063706 g ( )
37073707 }
37083708 f ( )
3709- consumeVal ( x2) // expected-error {{captured 'x2' cannot be consumed within a closure}}
3709+ consumeVal ( x2) // expected-error {{noncopyable 'x2' cannot be consumed when captured by a closure}}
37103710}
37113711
37123712/////////////////////////////
@@ -4106,14 +4106,14 @@ func inoutCaptureTest() -> (() -> ()) {
41064106
41074107 borrowVal ( x)
41084108 consumeVal ( x)
4109- // expected-error @-1 {{captured 'x' cannot be consumed within a closure}}
4109+ // expected-error @-1 {{noncopyable 'x' cannot be consumed when captured by a closure}}
41104110 x = NonTrivialStruct ( )
41114111
41124112 let g = {
41134113 x = NonTrivialStruct ( )
41144114 useInOut ( & x)
41154115 consumeVal ( x)
4116- // expected-error @-1 {{captured 'x' cannot be consumed within a closure}}
4116+ // expected-error @-1 {{noncopyable 'x' cannot be consumed when captured by a closure}}
41174117 }
41184118 g ( )
41194119
@@ -4130,13 +4130,13 @@ func inoutCaptureTestAddressOnlyGeneric<T : P>(_ t: T.Type) -> (() -> ()) {
41304130 }
41314131
41324132 borrowVal ( x)
4133- consumeVal ( x) // expected-error {{captured 'x' cannot be consumed within a closure}}
4133+ consumeVal ( x) // expected-error {{noncopyable 'x' cannot be consumed when captured by a closure}}
41344134 x = AddressOnlyGeneric < T > ( )
41354135
41364136 let g = {
41374137 x = AddressOnlyGeneric < T > ( )
41384138 useInOut ( & x)
4139- consumeVal ( x) // expected-error {{captured 'x' cannot be consumed within a closure}}
4139+ consumeVal ( x) // expected-error {{noncopyable 'x' cannot be consumed when captured by a closure}}
41404140 }
41414141 g ( )
41424142
0 commit comments