Skip to content

Commit 3e3e93b

Browse files
committed
Test: ~Copyable passed inout within closure
Add test coverage for a code pattern that briefly broke on main. rdar://162749287
1 parent 0287d65 commit 3e3e93b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/SILOptimizer/moveonly_correct.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,17 @@ public struct M_109232806: ~Copyable {
2323
}
2424
public func test_109232806(m: borrowing M_109232806) {
2525
_ = m.y
26+
}
27+
28+
29+
// rdar://162749287
30+
struct DonutEventHandler: ~Copyable {
31+
mutating func deliciouslyDo<Result>(
32+
operation: (inout Self) async throws -> Result,
33+
withHandler handler: (Int) async throws -> Void
34+
) async rethrows -> Result {
35+
return try await withoutActuallyEscaping(handler) { escapingHandler in
36+
return try await operation(&self)
37+
}
38+
}
2639
}

0 commit comments

Comments
 (0)