Skip to content

Commit 8c258a6

Browse files
committed
[wip] pile of test updates
most of these are mechanical changes to remove @_moveOnly but there's also some manual updates in here. too tired to separate.
1 parent 5111b0b commit 8c258a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+130
-209
lines changed

test/Constraints/moveonly_constraints.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// RUN: %target-typecheck-verify-swift
22

33
// a concrete move-only type
4-
@_moveOnly struct MO {
4+
struct MO : ~Copyable {
55
var x: Int?
66
}
77

8-
@_moveOnly struct Container {
8+
struct Container : ~Copyable {
99
var mo: MO = MO()
1010
}
1111

@@ -255,7 +255,7 @@ class SomeGuy: HasType { // expected-error {{type 'SomeGuy' does not conform to
255255
}
256256

257257
struct AnotherGuy: HasType { // expected-error {{type 'AnotherGuy' does not conform to protocol 'HasType'}}
258-
@_moveOnly struct Ty {} // expected-note {{possibly intended match 'AnotherGuy.Ty' does not conform to 'Copyable'}}
258+
struct Ty : ~Copyable {} // expected-note {{possibly intended match 'AnotherGuy.Ty' does not conform to 'Copyable'}}
259259
}
260260

261261
protocol Gives: HasType {

test/IRGen/moveonly_deinits.swift

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ class Klass {}
2222
// Struct Declarations //
2323
/////////////////////////
2424

25-
@_moveOnly
26-
struct KlassPairWithoutDeinit {
25+
struct KlassPairWithoutDeinit : ~Copyable {
2726
var lhs = Klass()
2827
var rhs = Klass()
2928
}
3029

31-
@_moveOnly
32-
struct KlassPairWithDeinit {
30+
struct KlassPairWithDeinit : ~Copyable {
3331
var lhs = Klass()
3432
var rhs = Klass()
3533

@@ -38,14 +36,12 @@ struct KlassPairWithDeinit {
3836
}
3937
}
4038

41-
@_moveOnly
42-
struct IntPairWithoutDeinit {
39+
struct IntPairWithoutDeinit : ~Copyable {
4340
var k: Int = 5
4441
var k2: Int = 6
4542
}
4643

47-
@_moveOnly
48-
struct IntPairWithDeinit {
44+
struct IntPairWithDeinit : ~Copyable {
4945
var k: Int = 5
5046
var k2: Int = 6
5147

@@ -195,14 +191,12 @@ public func testKlassPairWithDeinit() {
195191
// Enum Declarations //
196192
///////////////////////
197193

198-
@_moveOnly
199-
enum KlassEnumPairWithoutDeinit {
194+
enum KlassEnumPairWithoutDeinit : ~Copyable {
200195
case lhs(Klass)
201196
case rhs(Klass)
202197
}
203198

204-
@_moveOnly
205-
enum KlassEnumPairWithDeinit {
199+
enum KlassEnumPairWithDeinit : ~Copyable {
206200
case lhs(Klass)
207201
case rhs(Klass)
208202

@@ -211,14 +205,12 @@ enum KlassEnumPairWithDeinit {
211205
}
212206
}
213207

214-
@_moveOnly
215-
enum IntEnumPairWithoutDeinit {
208+
enum IntEnumPairWithoutDeinit : ~Copyable {
216209
case lhs(Int)
217210
case rhs(Int)
218211
}
219212

220-
@_moveOnly
221-
enum IntEnumPairWithDeinit {
213+
enum IntEnumPairWithDeinit : ~Copyable {
222214
case lhs(Int)
223215
case rhs(Int)
224216

test/Interpreter/moveonly.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ defer { runAllTests() }
88

99
var Tests = TestSuite("MoveOnlyTests")
1010

11-
@_moveOnly
12-
struct FD {
11+
struct FD : ~Copyable {
1312
var a = LifetimeTracked(0)
1413

1514
deinit {
@@ -51,8 +50,7 @@ Tests.test("global destroyed once") {
5150
// TODO (rdar://107494072): Move-only types with deinits declared inside
5251
// functions sometimes lose their deinit function.
5352
// When that's fixed, FD2 can be moved back inside the test closure below.
54-
@_moveOnly
55-
struct FD2 {
53+
struct FD2 : ~Copyable {
5654
var field = 5
5755
static var count = 0
5856
init() { FD2.count += 1 }

test/Interpreter/moveonly_bufferview.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
// Until we get support for emitting value witnesses for deinits, do not run
88
// this with optimizations.
99

10-
@_moveOnly
11-
public struct BufferView<T> {
10+
public struct BufferView<T> : ~Copyable {
1211
var ptr: UnsafeBufferPointer<T>
1312

1413
var count: Int {

test/Interpreter/moveonly_consuming_param.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
// REQUIRES: executable_test
44

5-
@_moveOnly
6-
struct Butt {
5+
struct Butt : ~Copyable {
76
var value: Int
87
deinit { print("disposing \(value)") }
98

test/Interpreter/moveonly_escaping_capture.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ class C {
1010
deinit { print("C died \(value)") }
1111
}
1212

13-
@_moveOnly
14-
struct Butt {
13+
struct Butt : ~Copyable {
1514
static var myButt: () -> () = {}
1615

1716
init(value: Int) { self._value = C(value: value) }

test/Interpreter/moveonly_escaping_capture_lifetimes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
// REQUIRES: executable_test
44

5-
@_moveOnly
6-
struct MO {
5+
struct MO : ~Copyable {
76
var x: Int
87
deinit { print("dying \(x)") }
98
}

test/Interpreter/moveonly_escaping_definite_initialization.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %target-run-simple-swift | %FileCheck %s
22
// REQUIRES: executable_test
33

4-
@_moveOnly
5-
struct MO {
4+
struct MO : ~Copyable {
65
var value: Int
76

87
func use() {}

test/Interpreter/moveonly_field_in_class_reflection.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
// a move-only field does not trap from trying to reflect and copy those
66
// move-only fields.
77

8-
@_moveOnly
9-
public struct MO {
8+
public struct MO : ~Copyable {
109
var x: Int8 = 0
1110
var y: Int8 = 0
1211
var z: Int8 = 0

test/Interpreter/moveonly_forget.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ func print_closing_MFD() { print("closing MaybeFileDescriptor") }
99

1010
enum E: Error { case err }
1111

12-
@_moveOnly
13-
struct FileDescriptor {
12+
struct FileDescriptor : ~Copyable {
1413
var fd: Int
1514
static var nextFD: Int = 0
1615

@@ -57,7 +56,7 @@ struct FileDescriptor {
5756
}
5857
}
5958

60-
@_moveOnly enum MaybeFileDescriptor {
59+
enum MaybeFileDescriptor : ~Copyable {
6160
case some(FileDescriptor)
6261
case nothing
6362

test/ModuleInterface/Inputs/moveonly_api.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ public enum Descriptor {
88
public func message() -> String { return "hello world" }
99
}
1010

11-
@_moveOnly
12-
public struct File {
11+
public struct File : ~Copyable {
1312

1413
#if SYNTHESIZE_ACCESSORS
1514
public var fd: Descriptor = .other(1337)

test/ModuleInterface/Inputs/moveonly_simple.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
public class Message { var s: String = "hello" }
33

4-
@_moveOnly
5-
public struct FileDescriptor {
4+
public struct FileDescriptor : ~Copyable {
65
public var x: Int = 0
76
public var msg: Message = Message()
87
}

test/ModuleInterface/moveonly_interface_flag.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
// CHECK: #if compiler(>=5.3) && $MoveOnly
2222
// CHECK-NEXT: extension Library.MoveOnlyStruct {
2323

24-
@_moveOnly public struct MoveOnlyStruct {
24+
public struct MoveOnlyStruct : ~Copyable {
2525
let x = 0
2626
}
2727

28-
@_moveOnly public enum MoveOnlyEnum {
28+
public enum MoveOnlyEnum : ~Copyable {
2929
case depth
3030
}
3131

test/SILGen/forget.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
func invokedDeinit() {}
55

6-
@_moveOnly enum MaybeFile {
6+
enum MaybeFile : ~Copyable {
77
case some(File)
88
case none
99

@@ -28,7 +28,7 @@ func invokedDeinit() {}
2828
// CHECK: destroy_value [[FILE]] : $File
2929
}
3030

31-
@_moveOnly struct File {
31+
struct File : ~Copyable {
3232
let fd: Int
3333
static var nextFD: Int = 0
3434

@@ -57,7 +57,7 @@ func invokedDeinit() {}
5757
}
5858
}
5959

60-
@_moveOnly struct PointerTree {
60+
struct PointerTree : ~Copyable {
6161
let left: Ptr
6262
let file: File
6363
let popularity: Int
@@ -144,7 +144,7 @@ final class Wallet {
144144
var numCards = 0
145145
}
146146

147-
@_moveOnly enum Ticket {
147+
enum Ticket : ~Copyable {
148148
case empty
149149
case within(Wallet)
150150

test/SILGen/moveonly.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@ public final class CopyableKlass {
88
var fd = FD()
99
}
1010

11-
@_moveOnly
12-
public struct FD {
11+
public struct FD : ~Copyable {
1312
var copyableKlass = CopyableKlass()
1413
}
1514

16-
@_moveOnly
17-
public struct NonTrivialStruct2 {
15+
public struct NonTrivialStruct2 : ~Copyable {
1816
var fd = FD()
1917
var copyableKlass = CopyableKlass()
2018
}
2119

22-
@_moveOnly
23-
public struct NonTrivialStruct {
20+
public struct NonTrivialStruct : ~Copyable {
2421
var fd = FD()
2522
var nonTrivialStruct2 = NonTrivialStruct2()
2623
var copyableKlass = CopyableKlass()
@@ -37,8 +34,7 @@ public struct NonTrivialCopyableStruct {
3734
var nonTrivialCopyableStruct2 = NonTrivialCopyableStruct2()
3835
}
3936

40-
@_moveOnly
41-
public enum NonTrivialEnum {
37+
public enum NonTrivialEnum : ~Copyable {
4238
case first
4339
case second(CopyableKlass)
4440
case third(NonTrivialStruct)
@@ -541,14 +537,12 @@ func assignCopyableKlass(_ x: CopyableKlass) {
541537
///////////////////////
542538

543539
enum EnumSwitchTests {
544-
@_moveOnly
545-
enum E2 {
540+
enum E2 : ~Copyable {
546541
case lhs(CopyableKlass)
547542
case rhs(FD)
548543
}
549544

550-
@_moveOnly
551-
enum E {
545+
enum E : ~Copyable {
552546
case first(NonTrivialStruct2)
553547
case second(NonTrivialStruct)
554548
case third(CopyableKlass)

test/SILGen/moveonly_deinit_access.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// This test makes sure that in various situations (ignoring errors), we
55
// properly handle deinits with move only types.
66

7-
@_moveOnly
8-
public struct FD {
7+
public struct FD : ~Copyable {
98
var i = 5
109
}
1110

test/SILGen/moveonly_deinit_module_no_body.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
// Just make sure we don't crash.
44

5-
@_moveOnly
6-
public struct S {
5+
public struct S : ~Copyable {
76
private let desc: Int
87

98
internal init(desc: Int) {

test/SILGen/moveonly_deinits.swift

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ func doSomething() {
2020
print("123")
2121
}
2222

23-
@_moveOnly
24-
struct KlassPairWithoutDeinit {
23+
struct KlassPairWithoutDeinit : ~Copyable {
2524
var lhs = Klass()
2625
var rhs = Klass()
2726
}
2827

29-
@_moveOnly
30-
struct KlassPairWithDeinit {
28+
struct KlassPairWithDeinit : ~Copyable {
3129
var lhs = Klass()
3230
var rhs = Klass()
3331

@@ -36,14 +34,12 @@ struct KlassPairWithDeinit {
3634
}
3735
}
3836

39-
@_moveOnly
40-
struct IntPairWithoutDeinit {
37+
struct IntPairWithoutDeinit : ~Copyable {
4138
var k: Int = 5
4239
var k2: Int = 6
4340
}
4441

45-
@_moveOnly
46-
struct IntPairWithDeinit {
42+
struct IntPairWithDeinit : ~Copyable {
4743
var k: Int = 5
4844
var k2: Int = 6
4945

@@ -286,14 +282,12 @@ public func testKlassPairWithDeinit() {
286282
// MARK: Enum Declarations //
287283
/////////////////////////////
288284

289-
@_moveOnly
290-
enum KlassEnumPairWithoutDeinit {
285+
enum KlassEnumPairWithoutDeinit : ~Copyable {
291286
case lhs(Klass)
292287
case rhs(Klass)
293288
}
294289

295-
@_moveOnly
296-
enum KlassEnumPairWithDeinit {
290+
enum KlassEnumPairWithDeinit : ~Copyable {
297291
case lhs(Klass)
298292
case rhs(Klass)
299293

@@ -302,14 +296,12 @@ enum KlassEnumPairWithDeinit {
302296
}
303297
}
304298

305-
@_moveOnly
306-
enum IntEnumPairWithoutDeinit {
299+
enum IntEnumPairWithoutDeinit : ~Copyable {
307300
case lhs(Int)
308301
case rhs(Int)
309302
}
310303

311-
@_moveOnly
312-
enum IntEnumPairWithDeinit {
304+
enum IntEnumPairWithDeinit : ~Copyable {
313305
case lhs(Int)
314306
case rhs(Int)
315307

0 commit comments

Comments
 (0)