@@ -935,55 +935,39 @@ NOTE(sil_referencebinding_inout_binding_here, none,
935
935
// MARK: Region Based Isolation Diagnostics
936
936
// ===----------------------------------------------------------------------===//
937
937
938
- NOTE(regionbasedisolation_maybe_race, none,
939
- " access can happen concurrently" , ())
940
- NOTE(regionbasedisolation_inout_sending_must_be_reinitialized, none,
941
- " 'inout sending' parameter must be reinitialized before function exit with a non-actor isolated value" ,
942
- ())
938
+ // READ THIS: Please when adding diagnostics for region based isolation, keep
939
+ // them ordered in sections depending on which emitter uses it. It makes it
940
+ // easier for people unfamiliar with the code to quickly see which diagnostics
941
+ // are used by which of the SendNonSendable emitters use.
942
+
943
+ // ===
944
+ // Misc
945
+
943
946
ERROR(regionbasedisolation_unknown_pattern, none,
944
947
" pattern that the region based isolation checker does not understand how to check. Please file a bug" ,
945
948
())
949
+ NOTE(regionbasedisolation_maybe_race, none,
950
+ " access can happen concurrently" , ())
951
+ NOTE(regionbasedisolation_type_is_non_sendable, none,
952
+ " %0 is a non-Sendable type" ,
953
+ (Type))
954
+
955
+ // ===
956
+ // Use After Send Emitter
946
957
947
958
ERROR(regionbasedisolation_named_transfer_yields_race, none,
948
959
" sending %0 risks causing data races" ,
949
960
(Identifier))
950
- NOTE(regionbasedisolation_type_is_non_sendable, none,
951
- " %0 is a non-Sendable type" ,
952
- (Type))
953
961
ERROR(regionbasedisolation_type_transfer_yields_race, none,
954
962
" sending value of non-Sendable type %0 risks causing data races" ,
955
963
(Type))
956
-
957
964
NOTE(regionbasedisolation_type_use_after_transfer, none,
958
965
" sending value of non-Sendable type %0 to %1 callee risks causing data races between %1 and local %2 uses" ,
959
966
(Type, ActorIsolation, ActorIsolation))
960
967
NOTE(regionbasedisolation_type_use_after_transfer_callee, none,
961
- " sending value of non-Sendable type %0 to %1 %2 %3 risks causing data races between %1 and local %4 uses" ,
962
- (Type, ActorIsolation, DescriptiveDeclKind, DeclName, ActorIsolation))
963
- NOTE(regionbasedisolation_type_isolated_capture_yields_race, none,
964
- " sending value of non-Sendable type %0 to %1 closure due to closure capture risks causing races in between %1 and %2 uses" ,
965
- (Type, ActorIsolation, ActorIsolation))
966
-
967
- ERROR(regionbasedisolation_inout_sending_cannot_be_actor_isolated, none,
968
- " 'inout sending' parameter %0 cannot be %1at end of function" ,
969
- (Identifier, StringRef))
970
- NOTE(regionbasedisolation_inout_sending_cannot_be_actor_isolated_note, none,
971
- " %1%0 risks causing races in between %1uses and caller uses since caller assumes value is not actor isolated" ,
972
- (Identifier, StringRef))
973
-
974
- ERROR(regionbasedisolation_out_sending_cannot_be_actor_isolated_type, none,
975
- " returning a %1 %0 value as a 'sending' result risks causing data races" ,
976
- (Type, StringRef))
977
- NOTE(regionbasedisolation_out_sending_cannot_be_actor_isolated_note_type, none,
978
- " returning a %1 %0 value risks causing races since the caller assumes the value can be safely sent to other isolation domains" ,
979
- (Type, StringRef))
980
-
981
- ERROR(regionbasedisolation_out_sending_cannot_be_actor_isolated_named, none,
982
- " returning %1 %0 as a 'sending' result risks causing data races" ,
983
- (Identifier, StringRef))
984
- NOTE(regionbasedisolation_out_sending_cannot_be_actor_isolated_note_named, none,
985
- " returning %1 %0 risks causing data races since the caller assumes that %0 can be safely sent to other isolation domains" ,
986
- (Identifier, StringRef))
968
+ " sending value of non-Sendable type %0 to %1 %2 %3 risks causing data "
969
+ " races between %1 and local %4 uses" ,
970
+ (Type, ActorIsolation, DescriptiveDeclKind, DeclName, ActorIsolation))
987
971
988
972
NOTE(regionbasedisolation_named_info_transfer_yields_race, none,
989
973
" sending %1%0 to %2 callee risks causing data races between %2 and local %3 uses" ,
@@ -992,57 +976,104 @@ NOTE(regionbasedisolation_named_info_transfer_yields_race_callee, none,
992
976
" sending %1%0 to %2 %3 %4 risks causing data races between %2 and local %5 uses" ,
993
977
(Identifier, StringRef, ActorIsolation, DescriptiveDeclKind, DeclName, ActorIsolation))
994
978
979
+ // Use after transfer closure.
980
+ NOTE(regionbasedisolation_type_isolated_capture_yields_race, none,
981
+ " sending value of non-Sendable type %0 to %1 closure due to closure capture risks causing races in between %1 and %2 uses" ,
982
+ (Type, ActorIsolation, ActorIsolation))
983
+
984
+ // Value captured in async let and reused.
985
+ NOTE(regionbasedisolation_named_nonisolated_asynclet_name, none,
986
+ " sending %0 into async let risks causing data races between async let uses and local uses" ,
987
+ (Identifier))
988
+
989
+ NOTE(regionbasedisolation_named_value_used_after_explicit_sending, none,
990
+ " %0 used after being passed as a 'sending' parameter; Later uses could race" ,
991
+ (Identifier))
992
+ NOTE(regionbasedisolation_named_isolated_closure_yields_race, none,
993
+ " %0%1 is captured by a %2 closure. %2 uses in closure may race against later %3 uses" ,
994
+ (StringRef, Identifier, ActorIsolation, ActorIsolation))
995
+
996
+ NOTE(regionbasedisolation_typed_use_after_sending, none,
997
+ " Passing value of non-Sendable type %0 as a 'sending' argument risks causing races in between local and caller code" ,
998
+ (Type))
999
+ NOTE(regionbasedisolation_typed_use_after_sending_callee, none,
1000
+ " Passing value of non-Sendable type %0 as a 'sending' argument to %1 %2 risks causing races in between local and caller code" ,
1001
+ (Type, DescriptiveDeclKind, DeclName))
1002
+
1003
+ // ===
1004
+ // Sending Never Sendable Emitter
1005
+
995
1006
NOTE(regionbasedisolation_named_transfer_non_transferrable, none,
996
1007
" sending %1%0 to %2 callee risks causing data races between %2 and %3 uses" ,
997
1008
(Identifier, StringRef, ActorIsolation, StringRef))
998
1009
NOTE(regionbasedisolation_named_transfer_non_transferrable_callee, none,
999
1010
" sending %1%0 to %2 %3 %4 risks causing data races between %2 and %5 uses" ,
1000
1011
(Identifier, StringRef, ActorIsolation, DescriptiveDeclKind, DeclName, StringRef))
1001
- NOTE(regionbasedisolation_named_nonisolated_asynclet_name, none,
1002
- " sending %0 into async let risks causing data races between async let uses and local uses" ,
1003
- (Identifier))
1004
1012
1005
1013
NOTE(regionbasedisolation_named_transfer_into_sending_param, none,
1006
- " %0%1 is passed as a 'sending' parameter; Uses in callee may race with later %0uses" ,
1014
+ " %0%1 is passed as a 'sending' parameter; Uses in callee may race with "
1015
+ " later %0uses" ,
1007
1016
(StringRef, Identifier))
1008
1017
NOTE(regionbasedisolation_named_notransfer_transfer_into_result, none,
1009
1018
" %0%1 cannot be a 'sending' result. %2 uses may race with caller uses" ,
1010
1019
(StringRef, Identifier, StringRef))
1011
- NOTE(regionbasedisolation_named_value_used_after_explicit_sending, none,
1012
- " %0 used after being passed as a 'sending' parameter; Later uses could race" ,
1013
- (Identifier))
1014
- NOTE(regionbasedisolation_named_isolated_closure_yields_race, none,
1015
- " %0%1 is captured by a %2 closure. %2 uses in closure may race against later %3 uses" ,
1016
- (StringRef, Identifier, ActorIsolation, ActorIsolation))
1017
1020
NOTE(regionbasedisolation_typed_tns_passed_to_sending, none,
1018
- " Passing %0 value of non-Sendable type %1 as a 'sending' parameter risks causing races inbetween %0 uses and uses reachable from the callee" ,
1021
+ " Passing %0 value of non-Sendable type %1 as a 'sending' parameter risks "
1022
+ " causing races inbetween %0 uses and uses reachable from the callee" ,
1019
1023
(StringRef, Type))
1024
+
1020
1025
NOTE(regionbasedisolation_typed_tns_passed_to_sending_callee, none,
1021
1026
" Passing %0 value of non-Sendable type %1 as a 'sending' parameter to %2 %3 risks causing races inbetween %0 uses and uses reachable from %3" ,
1022
1027
(StringRef, Type, DescriptiveDeclKind, DeclName))
1023
1028
1024
1029
NOTE(regionbasedisolation_named_transfer_nt_asynclet_capture, none,
1025
1030
" sending %1 %0 into async let risks causing data races between nonisolated and %1 uses" ,
1026
1031
(Identifier, StringRef))
1027
-
1028
- NOTE(regionbasedisolation_typed_use_after_sending, none,
1029
- " Passing value of non-Sendable type %0 as a 'sending' argument risks causing races in between local and caller code" ,
1030
- (Type))
1031
- NOTE(regionbasedisolation_typed_use_after_sending_callee, none,
1032
- " Passing value of non-Sendable type %0 as a 'sending' argument to %1 %2 risks causing races in between local and caller code" ,
1033
- (Type, DescriptiveDeclKind, DeclName))
1034
-
1035
1032
NOTE(regionbasedisolation_typed_transferneversendable_via_arg, none,
1036
1033
" sending %0 value of non-Sendable type %1 to %2 callee risks causing races in between %0 and %2 uses" ,
1037
1034
(StringRef, Type, ActorIsolation))
1038
1035
NOTE(regionbasedisolation_typed_transferneversendable_via_arg_callee, none,
1039
1036
" sending %0 value of non-Sendable type %1 to %2 %3 %4 risks causing races in between %0 and %2 uses" ,
1040
1037
(StringRef, Type, ActorIsolation, DescriptiveDeclKind, DeclName))
1041
1038
1042
- // Misc Error.
1039
+ // Error that is only used when the send non sendable emitter cannot discover any
1040
+ // information to give a better diagnostic.
1043
1041
ERROR(regionbasedisolation_task_or_actor_isolated_transferred, none,
1044
1042
" task or actor isolated value cannot be sent" , ())
1045
1043
1044
+ // ===
1045
+ // InOut Sending Emitter
1046
+
1047
+ NOTE(regionbasedisolation_inout_sending_must_be_reinitialized, none,
1048
+ " 'inout sending' parameter must be reinitialized before function exit with a non-actor isolated value" ,
1049
+ ())
1050
+ ERROR(regionbasedisolation_inout_sending_cannot_be_actor_isolated, none,
1051
+ " 'inout sending' parameter %0 cannot be %1at end of function" ,
1052
+ (Identifier, StringRef))
1053
+ NOTE(regionbasedisolation_inout_sending_cannot_be_actor_isolated_note, none,
1054
+ " %1%0 risks causing races in between %1uses and caller uses since caller assumes value is not actor isolated" ,
1055
+ (Identifier, StringRef))
1056
+
1057
+ // ===
1058
+ // Out Sending
1059
+
1060
+ ERROR(regionbasedisolation_out_sending_cannot_be_actor_isolated_type, none,
1061
+ " returning a %1 %0 value as a 'sending' result risks causing data races" ,
1062
+ (Type, StringRef))
1063
+ NOTE(regionbasedisolation_out_sending_cannot_be_actor_isolated_note_type, none,
1064
+ " returning a %1 %0 value risks causing races since the caller assumes the value can be safely sent to other isolation domains" ,
1065
+ (Type, StringRef))
1066
+ ERROR(regionbasedisolation_out_sending_cannot_be_actor_isolated_named, none,
1067
+ " returning %1 %0 as a 'sending' result risks causing data races" ,
1068
+ (Identifier, StringRef))
1069
+ NOTE(regionbasedisolation_out_sending_cannot_be_actor_isolated_note_named, none,
1070
+ " returning %1 %0 risks causing data races since the caller assumes that %0 can be safely sent to other isolation domains" ,
1071
+ (Identifier, StringRef))
1072
+
1073
+ // ===----------------------------------------------------------------------===//
1074
+ // MARK: Misc Diagnostics
1075
+ // ===----------------------------------------------------------------------===//
1076
+
1046
1077
// TODO: print the name of the nominal type
1047
1078
ERROR(deinit_not_visible, none,
1048
1079
" deinit of non-copyable type not visible in the current module" , ())
0 commit comments