Skip to content

Commit 6f51818

Browse files
authored
Merge pull request #3269 from SwiftPackageIndex/data-race-safety-wording
Soften the data race safety wording
2 parents 8405b59 + b8e5582 commit 6f51818

File tree

4 files changed

+41
-18
lines changed

4 files changed

+41
-18
lines changed

Resources/Markdown/docs/builds.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ You can [find more details in this issue](https://github.com/SwiftPackageIndex/S
9090

9191
<h3 id="data-race-safety">What is data race safety and how is it tested?</h3>
9292

93-
The Swift 6.0 compiler can check whether code is safe from data races at compile time when strict concurrency checks are enabled. The data race safety information we publish on package pages comes from metadata output by the compiler during our build process.
93+
The Swift 6.0 compiler can check whether code is safe from data races at compile time with “complete” concurrency checks enabled. The data race safety information we publish on package pages comes from diagnostics output by the compiler as we build each package.
9494

95-
Note that this does not affect package compatibility as shown in the compatibility matrix. A package can be fully compatible with Swift 6.x without opting into struct concurrency mode provided it is not running in Swift 6 language mode. For more information on opting into Swift 6 language mode, [read this for more information](https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/completechecking).
95+
It’s not possible for us to distinguish between a package that genuinely has no data race safety errors and one where the errors are being suppressed. All we can report on is the number of data race errors reported by the compiler.
96+
97+
Note that this does not affect package compatibility, as shown in the compatibility matrix. A package can be fully compatible with Swift 6.x without enabling strict concurrency checks, provided it is not running in Swift 6 language mode. For more information on opting into Swift 6 language mode, [read the Swift 6 migration guide for more information](https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/completechecking).

Sources/App/Views/PackageController/GetRoute.Model+ext.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,9 @@ extension API.PackageController.GetRoute.Model.Swift6Readiness {
649649
var text: String {
650650
switch dataRaceSafety {
651651
case .safe:
652-
return "Safe from data races"
652+
return "Zero data race safety errors"
653653
case .unsafe:
654-
return "Has data race errors"
654+
return "Has data race safety errors"
655655
case .unknown:
656656
return "No data race safety information available"
657657
}

Sources/App/Views/ReadyForSwift6/ReadyForSwift6Show+View.swift

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extension ReadyForSwift6Show {
3838
override func content() -> Node<HTML.BodyContext> {
3939
.group(
4040
.h2("Ready for Swift 6"),
41-
.p("The Swift 6 language mode prevents data-races at compile time. When you opt into Swift 6 mode, the compiler will produce errors when your code has a risk of concurrent access, turning hard-to-debug runtime failures into compiler errors."),
41+
.p("The Swift 6 language mode prevents data races at compile time. When you opt into Swift 6 mode, the compiler will produce errors when your code has a risk of concurrent access, turning hard-to-debug runtime failures into compiler errors."),
4242
.p("To track the progress of the Swift package ecosystem, the Swift Package Index is running regular package compatibility checks across all packages in the index."),
4343
.p(
4444
.text("For help migrating your project's code, see the "),
@@ -50,16 +50,16 @@ extension ReadyForSwift6Show {
5050
),
5151
.h3(
5252
.id("total-zero-errors"),
53-
"Total packages with Swift 6 zero data-race safety errors"
53+
"Total packages with Swift 6 zero data race safety errors"
5454
),
55-
.p("Packages with zero data-race safety compiler diagnostics during a successful build on at least one tested platform."),
55+
.p("This chart shows packages with zero data race safety compiler diagnostics during a successful build on at least one tested platform."),
5656
model.readyForSwift6Chart(kind: .compatiblePackages, includeTotals: true),
5757
.h3(
5858
.id("total-errors"),
59-
"Total Swift 6 data-race safety errors"
59+
"Total Swift 6 data race safety errors"
6060
),
6161
.p(
62-
.text("The total number of all data-race safety diagnostics across "),
62+
.text("This chart shows the total number of all data race safety diagnostics across "),
6363
.em("all"),
6464
.text(" packages.")
6565
),
@@ -74,7 +74,7 @@ extension ReadyForSwift6Show {
7474
),
7575
.p(
7676
.strong(.text("A: ")),
77-
.text("Swift 6 introduces complete concurrency checking, a compiler feature that checks your code for data-race safety. The number of data race safety errors reflects how many issues the compiler detected relating to these concurrency or data-race checks. The total errors chart plots the total number of these errors summed across all packages.")
77+
.text("Swift 6 introduces complete concurrency checking, a compiler feature that checks your code for data race safety. The number of data race safety errors reflects how many issues the compiler detected relating to these concurrency or data race checks. The total errors chart plots the total number of these errors summed across all packages.")
7878
),
7979
.hr(
8080
.class("minor")
@@ -96,6 +96,19 @@ extension ReadyForSwift6Show {
9696
.hr(
9797
.class("minor")
9898
),
99+
.p(
100+
.strong(.text("Q: ")),
101+
.text("Are packages that show zero data race compiler diagnostics guaranteed to be safe from data race errors?")
102+
),
103+
.p(
104+
.strong(.text("A: ")),
105+
.text("No. We gather data on data race safety from Swift compiler diagnostics with “complete” concurrency checks enabled. We can’t tell if the diagnostics produce zero errors due to a genuine lack of data race safety errors or whether errors have been suppressed using techniques like "),
106+
.code("@unchecked Sendable"),
107+
.text(".")
108+
),
109+
.hr(
110+
.class("minor")
111+
),
99112
.p(
100113
.strong(.text("Q: ")),
101114
.text("Why use "),
@@ -106,7 +119,7 @@ extension ReadyForSwift6Show {
106119
),
107120
.p(
108121
.strong(.text("A: ")),
109-
.text("Data-race safety diagnostics are determined in different stages of the compiler. For example, type checking produces some data-race safety errors, and others are diagnosed during control-flow analysis after code generation. If type checking produces errors, the compiler will not proceed to code generation, so testing with "),
122+
.text("Data race safety diagnostics are determined in different stages of the compiler. For example, type checking produces some data race safety errors, and others are diagnosed during control-flow analysis after code generation. If type checking produces errors, the compiler will not proceed to code generation, so testing with "),
110123
.code("-swift-version 6"),
111124
.text(" would show fewer errors than really exist across the package ecosystem.")
112125
),

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ReadyForSwift6Show.1.html

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ <h1>
8383
<main>
8484
<div class="inner">
8585
<h2>Ready for Swift 6</h2>
86-
<p>The Swift 6 language mode prevents data-races at compile time. When you opt into Swift 6 mode, the compiler will produce errors when your code has a risk of concurrent access, turning hard-to-debug runtime failures into compiler errors.</p>
86+
<p>The Swift 6 language mode prevents data races at compile time. When you opt into Swift 6 mode, the compiler will produce errors when your code has a risk of concurrent access, turning hard-to-debug runtime failures into compiler errors.</p>
8787
<p>To track the progress of the Swift package ecosystem, the Swift Package Index is running regular package compatibility checks across all packages in the index.</p>
8888
<p>For help migrating your project's code, see the
8989
<a href="https://www.swift.org/migration/documentation/migrationguide/">Swift 6 language mode migration guide</a>.
9090
</p>
91-
<h3 id="total-zero-errors">Total packages with Swift 6 zero data-race safety errors</h3>
92-
<p>Packages with zero data-race safety compiler diagnostics during a successful build on at least one tested platform.</p>
91+
<h3 id="total-zero-errors">Total packages with Swift 6 zero data race safety errors</h3>
92+
<p>This chart shows packages with zero data race safety compiler diagnostics during a successful build on at least one tested platform.</p>
9393
<p>Couldn’t load chart data.</p>
94-
<h3 id="total-errors">Total Swift 6 data-race safety errors</h3>
95-
<p>The total number of all data-race safety diagnostics across
94+
<h3 id="total-errors">Total Swift 6 data race safety errors</h3>
95+
<p>This chart shows the total number of all data race safety diagnostics across
9696
<em>all</em> packages.
9797
</p>
9898
<p>Couldn’t load chart data.</p>
@@ -101,7 +101,7 @@ <h3 id="faq">Frequently asked questions</h3>
101101
<strong>Q: </strong>What is a “data race safety error”?
102102
</p>
103103
<p>
104-
<strong>A: </strong>Swift 6 introduces complete concurrency checking, a compiler feature that checks your code for data-race safety. The number of data race safety errors reflects how many issues the compiler detected relating to these concurrency or data-race checks. The total errors chart plots the total number of these errors summed across all packages.
104+
<strong>A: </strong>Swift 6 introduces complete concurrency checking, a compiler feature that checks your code for data race safety. The number of data race safety errors reflects how many issues the compiler detected relating to these concurrency or data race checks. The total errors chart plots the total number of these errors summed across all packages.
105105
</p>
106106
<hr class="minor"/>
107107
<p>
@@ -114,13 +114,21 @@ <h3 id="faq">Frequently asked questions</h3>
114114
<code>xcodebuild</code> to achieve this by enabling all data race safety checks in the compiler.
115115
</p>
116116
<hr class="minor"/>
117+
<p>
118+
<strong>Q: </strong>Are packages that show zero data race compiler diagnostics guaranteed to be safe from data race errors?
119+
</p>
120+
<p>
121+
<strong>A: </strong>No. We gather data on data race safety from Swift compiler diagnostics with “complete” concurrency checks enabled. We can’t tell if the diagnostics produce zero errors due to a genuine lack of data race safety errors or whether errors have been suppressed using techniques like
122+
<code>@unchecked Sendable</code>.
123+
</p>
124+
<hr class="minor"/>
117125
<p>
118126
<strong>Q: </strong>Why use
119127
<code>-strict-concurrency=complete</code> instead of
120128
<code>-swift-version 6</code>?
121129
</p>
122130
<p>
123-
<strong>A: </strong>Data-race safety diagnostics are determined in different stages of the compiler. For example, type checking produces some data-race safety errors, and others are diagnosed during control-flow analysis after code generation. If type checking produces errors, the compiler will not proceed to code generation, so testing with
131+
<strong>A: </strong>Data race safety diagnostics are determined in different stages of the compiler. For example, type checking produces some data race safety errors, and others are diagnosed during control-flow analysis after code generation. If type checking produces errors, the compiler will not proceed to code generation, so testing with
124132
<code>-swift-version 6</code> would show fewer errors than really exist across the package ecosystem.
125133
</p>
126134
<hr class="minor"/>

0 commit comments

Comments
 (0)