Skip to content

Commit 8bea351

Browse files
committed
[rbi] Remove highlights from errors.
I have noticed over time when working on the command line, we often times highlight too large of an expression due to the locations provided to us by earlier parts of the compiler. This isn't technically necessary and the following doesn't look nice... so remove it. ``` test5.swift:171:16: error: sending 'x' risks causing data races [#SendingRisksDataRace] 169 | let _ = { 170 | nonescapingAsyncUse { @mainactor in 171 | _� _� _� _� _�u_�s_�e_�V_�a_�l_�u_�e_�(_�x_�) | |- error: sending 'x' risks causing data races [#SendingRisksDataRace] | `- note: task-isolated 'x' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses 172 | } 173 | } ```
1 parent 20bee09 commit 8bea351

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

lib/SILOptimizer/Mandatory/SendNonSendable.cpp

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@ class UseAfterSendDiagnosticEmitter {
894894
ApplyIsolationCrossing isolationCrossing) {
895895
// Emit the short error.
896896
diagnoseError(loc, diag::regionbasedisolation_named_send_yields_race, name)
897-
.highlight(loc.getSourceRange())
898897
.limitBehaviorIf(getBehaviorLimit());
899898

900899
// Then emit the note with greater context.
@@ -928,7 +927,6 @@ class UseAfterSendDiagnosticEmitter {
928927
const ValueDecl *callee) {
929928
// Emit the short error.
930929
diagnoseError(loc, diag::regionbasedisolation_named_send_yields_race, name)
931-
.highlight(loc.getSourceRange())
932930
.limitBehaviorIf(getBehaviorLimit());
933931

934932
// Then emit the note with greater context.
@@ -953,7 +951,6 @@ class UseAfterSendDiagnosticEmitter {
953951
Identifier name) {
954952
// Emit the short error.
955953
diagnoseError(loc, diag::regionbasedisolation_named_send_yields_race, name)
956-
.highlight(loc.getSourceRange())
957954
.limitBehaviorIf(getBehaviorLimit());
958955

959956
diagnoseNote(
@@ -965,7 +962,6 @@ class UseAfterSendDiagnosticEmitter {
965962
ApplyIsolationCrossing isolationCrossing) {
966963
diagnoseError(loc, diag::regionbasedisolation_type_send_yields_race,
967964
inferredType)
968-
.highlight(loc.getSourceRange())
969965
.limitBehaviorIf(getBehaviorLimit());
970966

971967
auto calleeIsolationStr =
@@ -989,14 +985,12 @@ class UseAfterSendDiagnosticEmitter {
989985
void emitNamedUseofStronglySentValue(SILLocation loc, Identifier name) {
990986
// Emit the short error.
991987
diagnoseError(loc, diag::regionbasedisolation_named_send_yields_race, name)
992-
.highlight(loc.getSourceRange())
993988
.limitBehaviorIf(getBehaviorLimit());
994989

995990
// Then emit the note with greater context.
996991
diagnoseNote(
997992
loc, diag::regionbasedisolation_named_value_used_after_explicit_sending,
998-
name)
999-
.highlight(loc.getSourceRange());
993+
name);
1000994

1001995
// Finally the require points.
1002996
emitRequireInstDiagnostics();
@@ -1005,7 +999,6 @@ class UseAfterSendDiagnosticEmitter {
1005999
void emitTypedUseOfStronglySentValue(SILLocation loc, Type inferredType) {
10061000
diagnoseError(loc, diag::regionbasedisolation_type_send_yields_race,
10071001
inferredType)
1008-
.highlight(loc.getSourceRange())
10091002
.limitBehaviorIf(getBehaviorLimit());
10101003
if (auto callee = getSendingCallee()) {
10111004
diagnoseNote(loc,
@@ -1024,7 +1017,6 @@ class UseAfterSendDiagnosticEmitter {
10241017
ApplyIsolationCrossing isolationCrossing) {
10251018
// Emit the short error.
10261019
diagnoseError(loc, diag::regionbasedisolation_named_send_yields_race, name)
1027-
.highlight(loc.getSourceRange())
10281020
.limitBehaviorIf(getBehaviorLimit());
10291021

10301022
auto descriptiveKindStr =
@@ -1039,8 +1031,7 @@ class UseAfterSendDiagnosticEmitter {
10391031
diagnoseNote(loc,
10401032
diag::regionbasedisolation_named_isolated_closure_yields_race,
10411033
isDisconnected, descriptiveKindStr, name, calleeIsolationStr,
1042-
callerIsolationStr)
1043-
.highlight(loc.getSourceRange());
1034+
callerIsolationStr);
10441035
emitRequireInstDiagnostics();
10451036
}
10461037

@@ -1049,7 +1040,6 @@ class UseAfterSendDiagnosticEmitter {
10491040
ApplyIsolationCrossing isolationCrossing) {
10501041
diagnoseError(loc, diag::regionbasedisolation_type_send_yields_race,
10511042
inferredType)
1052-
.highlight(loc.getSourceRange())
10531043
.limitBehaviorIf(getBehaviorLimit());
10541044

10551045
auto calleeIsolationStr =
@@ -1125,14 +1115,12 @@ class UseAfterSendDiagnosticEmitter {
11251115
auto require = requireInsts.pop_back_val();
11261116
switch (require.getKind()) {
11271117
case RequireInst::UseAfterSend:
1128-
diagnoseNote(*require, diag::regionbasedisolation_maybe_race)
1129-
.highlight(require->getLoc().getSourceRange());
1118+
diagnoseNote(*require, diag::regionbasedisolation_maybe_race);
11301119
continue;
11311120
case RequireInst::InOutReinitializationNeeded:
11321121
diagnoseNote(
11331122
*require,
1134-
diag::regionbasedisolation_inout_sending_must_be_reinitialized)
1135-
.highlight(require->getLoc().getSourceRange());
1123+
diag::regionbasedisolation_inout_sending_must_be_reinitialized);
11361124
continue;
11371125
}
11381126
llvm_unreachable("Covered switch isn't covered?!");
@@ -1598,7 +1586,6 @@ class SendNeverSentDiagnosticEmitter {
15981586
ApplyIsolationCrossing crossing) {
15991587
diagnoseError(loc, diag::regionbasedisolation_type_send_yields_race,
16001588
inferredType)
1601-
.highlight(loc.getSourceRange())
16021589
.limitBehaviorIf(getBehaviorLimit());
16031590

16041591
auto descriptiveKindStr =
@@ -1635,15 +1622,13 @@ class SendNeverSentDiagnosticEmitter {
16351622
diagnoseNote(loc,
16361623
diag::regionbasedisolation_named_isolated_closure_yields_race,
16371624
isDisconnected, descriptiveKindStr, name, calleeIsolationStr,
1638-
callerIsolationStr)
1639-
.highlight(loc.getSourceRange());
1625+
callerIsolationStr);
16401626
}
16411627

16421628
void emitTypedSendingNeverSendableToSendingParam(SILLocation loc,
16431629
Type inferredType) {
16441630
diagnoseError(loc, diag::regionbasedisolation_type_send_yields_race,
16451631
inferredType)
1646-
.highlight(loc.getSourceRange())
16471632
.limitBehaviorIf(getBehaviorLimit());
16481633

16491634
auto descriptiveKindStr =
@@ -1742,7 +1727,6 @@ class SendNeverSentDiagnosticEmitter {
17421727
diagnoseError(loc,
17431728
diag::regionbasedisolation_typed_tns_passed_sending_closure,
17441729
descriptiveKindStr)
1745-
.highlight(loc.getSourceRange())
17461730
.limitBehaviorIf(behaviorLimit);
17471731
};
17481732

@@ -1798,7 +1782,6 @@ class SendNeverSentDiagnosticEmitter {
17981782

17991783
void emitNamedOnlyError(SILLocation loc, Identifier name) {
18001784
diagnoseError(loc, diag::regionbasedisolation_named_send_yields_race, name)
1801-
.highlight(getOperand()->getUser()->getLoc().getSourceRange())
18021785
.limitBehaviorIf(getBehaviorLimit());
18031786
}
18041787

0 commit comments

Comments
 (0)