Skip to content

Commit d169154

Browse files
authored
Fix warnings in Swift 6.2 about non-sendable types in isolated closures (#107)
* Fix warnings in Swift 6.2 about non-sendable types in isolated closures rdar://152474585 * Update the `check-source` script to allow 2025 in the license header. * Update the necessary license header comment style
1 parent 8357c77 commit d169154

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

Sources/SwiftDocCPluginUtilities/BuildGraph/DocumentationBuildGraph.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This source file is part of the Swift.org open source project
22
//
3-
// Copyright (c) 2024 Apple Inc. and the Swift project authors
3+
// Copyright (c) 2024-2025 Apple Inc. and the Swift project authors
44
// Licensed under Apache License v2.0 with Runtime Library Exception
55
//
66
// See https://swift.org/LICENSE.txt for license information
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111
/// A target that can have a documentation task in the build graph
12-
protocol DocumentationBuildGraphTarget {
12+
protocol DocumentationBuildGraphTarget: SendableMetatype {
1313
typealias ID = String
1414
/// The unique identifier of this target
1515
var id: ID { get }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This source file is part of the Swift.org open source project
2+
//
3+
// Copyright (c) 2025 Apple Inc. and the Swift project authors
4+
// Licensed under Apache License v2.0 with Runtime Library Exception
5+
//
6+
// See https://swift.org/LICENSE.txt for license information
7+
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
// In Swift 6.2, metatypes are no longer sendable by default (SE-0470).
10+
// Instead a type needs to conform to `SendableMetatype` to indicate that its metatype is sendable.
11+
//
12+
// However, `SendableMetatype` doesn't exist before Swift 6.1 so we define an internal alias to `Any` here.
13+
// This means that conformances to `SendableMetatype` has no effect before 6.2 indicates metatype sendability in 6.2 onwards.
14+
//
15+
// Note: Adding a protocol requirement to a _public_ API is a breaking change.
16+
17+
#if compiler(<6.2)
18+
typealias SendableMetatype = Any
19+
#endif

bin/check-source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818

1919
function replace_acceptable_years() {
2020
# this needs to replace all acceptable forms with 'YEARS'
21-
sed -e 's/20[12][78901234]-20[12][8901234]/YEARS/' -e 's/20[12][8901234]/YEARS/'
21+
sed -e 's/20[12][789012345]-20[12][89012345]/YEARS/' -e 's/20[12][89012345]/YEARS/'
2222
}
2323

2424
printf "=> Checking for unacceptable language… "

0 commit comments

Comments
 (0)