Skip to content

Commit b4ac04c

Browse files
committed
Only explictly mark generated structs Sendable for public structs
1 parent 4ac2eb7 commit b4ac04c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Sources/RswiftGenerators/SwiftSyntax/Struct.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,14 @@ public struct Struct {
446446
}
447447
}
448448

449+
public mutating func markSendable() {
450+
self.protocols.append(.init(module: .host, rawName: "Sendable"))
451+
452+
for i in structs.indices {
453+
structs[i].markSendable()
454+
}
455+
}
456+
449457
public func prettyPrint() -> String {
450458
var pp = PrettyPrinter()
451459
render(&pp)

Sources/rswift/RswiftCore.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public struct RswiftCore {
201201
valueCodeString: validateLines
202202
)
203203

204-
var s = Struct(name: structName, protocols: [.init(module: .host, rawName: "Sendable")], additionalModuleReferences: [.rswiftResources]) {
204+
var s = Struct(name: structName, additionalModuleReferences: [.rswiftResources]) {
205205
Init.bundle
206206

207207
if generators.contains(.project), !projectStruct.isEmpty {
@@ -289,6 +289,8 @@ public struct RswiftCore {
289289

290290
if accessLevel == .publicLevel {
291291
s.setAccessControl(.public)
292+
293+
s.markSendable()
292294
}
293295

294296
let imports = Set(s.allModuleReferences.compactMap(\.name))

0 commit comments

Comments
 (0)