Skip to content

Commit 389078d

Browse files
committed
[region-isolation] Remove count of emitted diagnostics from main diagnostic.
These are not actionable to the user.
1 parent cf780b2 commit 389078d

File tree

4 files changed

+58
-60
lines changed

4 files changed

+58
-60
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ WARNING(transfer_yields_race, none,
883883
"non-sendable value sent across isolation domains that could be concurrently accessed later in this function (%0 access site%select{|s}1 displayed%select{|, %3 more hidden}2)",
884884
(unsigned, bool, bool, unsigned))
885885
WARNING(call_site_transfer_yields_race, none,
886-
"passing argument of non-sendable type %0 from %1 context to %2 context at this call site could yield a race with accesses later in this function (%3 access site%select{|s}4 displayed%select{|, %6 more hidden}5)",
887-
(Type, ActorIsolation, ActorIsolation, unsigned, bool, bool, unsigned))
886+
"passing argument of non-sendable type %0 from %1 context to %2 context at this call site could yield a race with accesses later in this function",
887+
(Type, ActorIsolation, ActorIsolation))
888888
NOTE(possible_racy_access_site, none,
889889
"access here could race", ())
890890

lib/SILOptimizer/Mandatory/TransferNonSendable.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,13 +1594,13 @@ class TransferRequireAccumulator {
15941594

15951595
void accumulateTransferredReason(PartitionOp requireOp,
15961596
const TransferredReason &transferredReason) {
1597-
for (auto [distance, transferOp] : transferredReason.transferOps)
1597+
for (auto &[distance, transferOp] : transferredReason.transferOps)
15981598
requirementsForTransfers[transferOp].insert({requireOp, distance});
15991599
}
16001600

16011601
void emitErrorsForTransferRequire(
16021602
unsigned numRequiresPerTransfer = UINT_MAX) const {
1603-
for (auto [transferOp, requireOps] : requirementsForTransfers) {
1603+
for (auto &[transferOp, requireOps] : requirementsForTransfers) {
16041604
unsigned numProcessed = std::min(
16051605
{(unsigned)requireOps.size(), (unsigned)numRequiresPerTransfer});
16061606

@@ -1637,7 +1637,7 @@ class TransferRequireAccumulator {
16371637
SWIFT_DEBUG_DUMP { print(llvm::dbgs()); }
16381638

16391639
void print(llvm::raw_ostream &os) const {
1640-
for (auto [transferOp, requireOps] : requirementsForTransfers) {
1640+
for (auto &[transferOp, requireOps] : requirementsForTransfers) {
16411641
os << " ┌──╼ TRANSFER: ";
16421642
transferOp.print(os);
16431643

@@ -1675,8 +1675,7 @@ class TransferRequireAccumulator {
16751675
.diagnose(argExpr->getLoc(), diag::call_site_transfer_yields_race,
16761676
argExpr->findOriginalType(),
16771677
isolationCrossing.value().getCallerIsolation(),
1678-
isolationCrossing.value().getCalleeIsolation(), numDisplayed,
1679-
numDisplayed != 1, numHidden > 0, numHidden)
1678+
isolationCrossing.value().getCalleeIsolation())
16801679
.highlight(argExpr->getSourceRange());
16811680
return true;
16821681
}
@@ -2178,8 +2177,7 @@ class PartitionAnalysis {
21782177
.diagnose(argExpr->getLoc(), diag::call_site_transfer_yields_race,
21792178
argExpr->findOriginalType(),
21802179
isolationCrossing.value().getCallerIsolation(),
2181-
isolationCrossing.value().getCalleeIsolation(), numDisplayed,
2182-
numDisplayed != 1, numHidden > 0, numHidden)
2180+
isolationCrossing.value().getCalleeIsolation())
21832181
.highlight(argExpr->getSourceRange());
21842182
return true;
21852183
}

test/Concurrency/sendable_checking.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ final class NonSendable {
252252
await update()
253253
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
254254
// expected-tns-warning@-2 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
255-
// expected-tns-warning@-3 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function (3 access sites displayed)}}
255+
// expected-tns-warning@-3 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function}}
256256

257257

258258
await self.update()
@@ -277,7 +277,7 @@ func testNonSendableBaseArg() async {
277277
let t = NonSendable()
278278
await t.update()
279279
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
280-
// expected-tns-warning@-2 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function (1 access site displayed)}}
280+
// expected-tns-warning@-2 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function}}
281281

282282
_ = await t.x
283283
// expected-warning @-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
@@ -297,7 +297,7 @@ func callNonisolatedAsyncClosure(
297297
await g(ns)
298298
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
299299
// expected-tns-warning@-2 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
300-
// expected-tns-warning@-3 {{passing argument of non-sendable type 'NonSendable' from main actor-isolated context to nonisolated context at this call site could yield a race with accesses later in this function (1 access site displayed)}}
300+
// expected-tns-warning@-3 {{passing argument of non-sendable type 'NonSendable' from main actor-isolated context to nonisolated context at this call site could yield a race with accesses later in this function}}
301301

302302
let f: (NonSendable) async -> () = globalSendable // okay
303303
await f(ns)

0 commit comments

Comments
 (0)