Skip to content

Commit b4a97de

Browse files
authored
Merge pull request swiftlang#39453 from ktoso/wip-pick-wip-sendable-fixups
🍒 [5.5][Concurrent] Warnings/errors should use "sendable" not "concurrent"
2 parents 18bb92d + d15b684 commit b4a97de

File tree

11 files changed

+39
-39
lines changed

11 files changed

+39
-39
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,9 @@ WARNING(semantic_function_improper_nesting, none, "'@_semantics' function calls
668668

669669
// Capture promotion diagnostics
670670
WARNING(capturepromotion_concurrentcapture_mutation, none,
671-
"'%0' mutated after capture by concurrent closure", (StringRef))
671+
"'%0' mutated after capture by sendable closure", (StringRef))
672672
NOTE(capturepromotion_concurrentcapture_closure_here, none,
673-
"variable captured by concurrent closure", ())
673+
"variable captured by sendable closure", ())
674674
NOTE(capturepromotion_concurrentcapture_capturinguse_here, none,
675675
"capturing use", ())
676676
NOTE(capturepromotion_variable_defined_here,none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,28 +3837,28 @@ NOTE(silence_debug_description_in_interpolation_segment_call,none,
38373837
"use 'String(describing:)' to silence this warning", ())
38383838

38393839
NOTE(noescape_parameter,none,
3840-
"parameter %1 is implicitly %select{non-escaping|non-concurrent}0",
3840+
"parameter %1 is implicitly %select{non-escaping|non-sendable}0",
38413841
(unsigned, Identifier))
38423842
NOTE(generic_parameters_always_escaping,none,
38433843
"generic parameters are always considered '@escaping'", ())
38443844

38453845
ERROR(passing_noattrfunc_to_attrfunc,none,
3846-
"passing %select{non-escaping|non-concurrent}0 parameter %1 to function "
3846+
"passing %select{non-escaping|non-sendable}0 parameter %1 to function "
38473847
"expecting %select{an @escaping|a @Sendable}0 closure",
38483848
(unsigned, Identifier))
38493849
ERROR(converting_noespace_param_to_generic_type,none,
38503850
"converting non-escaping parameter %0 to generic parameter %1 may allow it to escape",
38513851
(Identifier, Type))
38523852
ERROR(assigning_noattrfunc_to_attrfunc,none,
3853-
"assigning %select{non-escaping|non-concurrent}0 parameter %1 to "
3853+
"assigning %select{non-escaping|non-sendable}0 parameter %1 to "
38543854
"%select{an @escaping|a @Sendable}0 closure",
38553855
(unsigned, Identifier))
38563856
ERROR(general_noattrfunc_to_attr,none,
3857-
"using %select{non-escaping|non-concurrent}0 parameter %1 in a context "
3857+
"using %select{non-escaping|non-sendable}0 parameter %1 in a context "
38583858
"expecting %select{an @escaping|a @Sendable}0 closure",
38593859
(unsigned, Identifier))
38603860
ERROR(converting_noattrfunc_to_type,none,
3861-
"converting %select{non-escaping|non-concurrent function}0 value to %1 "
3861+
"converting %select{non-escaping|non-sendable function}0 value to %1 "
38623862
"may %select{allow it to escape|introduce data races}0",
38633863
(unsigned, Type))
38643864

include/swift/Runtime/Concurrent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ template <class ElemTy> struct ConcurrentList {
6363

6464
/// Remove all of the links in the chain. This method leaves
6565
/// the list at a usable state and new links can be added.
66-
/// Notice that this operation is non-concurrent because
66+
/// Notice that this operation is non-sendable because
6767
/// we have no way of ensuring that no one is currently
6868
/// traversing the list.
6969
void clear() {

lib/Sema/CSDiagnostics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ class AttributedFuncToTypeConversionFailure final : public ContextualFailure {
728728
bool diagnoseAsError() override;
729729

730730
private:
731-
/// Emit tailored diagnostics for no-escape/non-concurrent parameter
731+
/// Emit tailored diagnostics for no-escape/non-sendable parameter
732732
/// conversions e.g. passing such parameter as an @escaping or @Sendable
733733
/// argument, or trying to assign it to a variable which expects @escaping
734734
/// or @Sendable function.

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ namespace {
18091809
}
18101810

18111811
if (result == AsyncMarkingResult::FoundAsync) {
1812-
// Check for non-concurrent types.
1812+
// Check for non-sendable types.
18131813
bool problemFound =
18141814
diagnoseNonConcurrentTypesInReference(
18151815
concDeclRef, getDeclContext(), declLoc,

lib/Sema/TypeCheckConcurrency.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void checkOverrideActorIsolation(ValueDecl *value);
200200
/// as async functions or actors.
201201
bool contextUsesConcurrencyFeatures(const DeclContext *dc);
202202

203-
/// Diagnose the presence of any non-concurrent types when referencing a
203+
/// Diagnose the presence of any non-sendable types when referencing a
204204
/// given declaration from a particular declaration context.
205205
///
206206
/// This function should be invoked any time that the given declaration

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2907,7 +2907,7 @@ bool ConformanceChecker::checkActorIsolation(
29072907
witnessGlobalActor->isEqual(requirementGlobalActor))
29082908
return false;
29092909

2910-
// For cross-actor references, check for non-concurrent types.
2910+
// For cross-actor references, check for non-sendable types.
29112911
if (isCrossActor) {
29122912
// If the requirement was imported from Objective-C, it may not have been
29132913
// annotated appropriately. Allow the mismatch.

test/ClangImporter/objc_async.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ func testSlowServerOldSchool(slowServer: SlowServer) {
9090
_ = slowServer.allOperations
9191
}
9292

93-
func testSendable(fn: () -> Void) { // expected-note{{parameter 'fn' is implicitly non-concurrent}}
93+
func testSendable(fn: () -> Void) { // expected-note{{parameter 'fn' is implicitly non-sendable}}
9494
doSomethingConcurrently(fn)
95-
// expected-error@-1{{passing non-concurrent parameter 'fn' to function expecting a @Sendable closure}}
95+
// expected-error@-1{{passing non-sendable parameter 'fn' to function expecting a @Sendable closure}}
9696
doSomethingConcurrentlyButUnsafe(fn) // okay, @Sendable not part of the type
9797

9898
var x = 17

test/Concurrency/actor_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ func checkLocalFunctions() async {
614614
local1()
615615
local2()
616616

617-
// Non-concurrent closures don't cause problems.
617+
// non-sendable closures don't cause problems.
618618
acceptClosure {
619619
local1()
620620
local2()

test/Concurrency/concurrentfunction_capturediagnostics.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ func testCaseTrivialValue() {
2929
// We only emit a warning here since we use the last write.
3030
//
3131
// TODO: Should we emit for all writes?
32-
i.addOne() // expected-warning {{'i' mutated after capture by concurrent closure}}
32+
i.addOne() // expected-warning {{'i' mutated after capture by sendable closure}}
3333
// expected-note @-14 {{variable defined here}}
34-
// expected-note @-14 {{variable captured by concurrent closure}}
34+
// expected-note @-14 {{variable captured by sendable closure}}
3535
// expected-note @-14 {{capturing use}}
3636
// expected-note @-14 {{capturing use}}
3737
// expected-note @-14 {{capturing use}}
@@ -46,9 +46,9 @@ func testCaseTrivialValue2() {
4646
}
4747

4848
i2 = 20
49-
i2 += 21 // expected-warning {{'i2' mutated after capture by concurrent closure}}
49+
i2 += 21 // expected-warning {{'i2' mutated after capture by sendable closure}}
5050
// expected-note @-9 {{variable defined here}}
51-
// expected-note @-9 {{variable captured by concurrent closure}}
51+
// expected-note @-9 {{variable captured by sendable closure}}
5252
// expected-note @-9 {{capturing use}}
5353
// expected-note @-9 {{capturing use}}
5454
// expected-note @-9 {{capturing use}}
@@ -62,9 +62,9 @@ func testCaseTrivialValue3() {
6262
print(i3 + 19)
6363
}
6464

65-
i3 = 20 // expected-warning {{'i3' mutated after capture by concurrent closure}}
65+
i3 = 20 // expected-warning {{'i3' mutated after capture by sendable closure}}
6666
// expected-note @-8 {{variable defined here}}
67-
// expected-note @-8 {{variable captured by concurrent closure}}
67+
// expected-note @-8 {{variable captured by sendable closure}}
6868
// expected-note @-8 {{capturing use}}
6969
// expected-note @-8 {{capturing use}}
7070
// expected-note @-8 {{capturing use}}
@@ -78,9 +78,9 @@ func testCaseTrivialValue4() {
7878
print(i4 + 19)
7979
}
8080

81-
inoutUserInt(&i4) // expected-warning {{'i4' mutated after capture by concurrent closure}}
81+
inoutUserInt(&i4) // expected-warning {{'i4' mutated after capture by sendable closure}}
8282
// expected-note @-8 {{variable defined here}}
83-
// expected-note @-8 {{variable captured by concurrent closure}}
83+
// expected-note @-8 {{variable captured by sendable closure}}
8484
// expected-note @-8 {{capturing use}}
8585
// expected-note @-8 {{capturing use}}
8686
// expected-note @-8 {{capturing use}}
@@ -98,9 +98,9 @@ func testCaseClass() {
9898
print(i)
9999
}
100100

101-
i = Klass() // expected-warning {{'i' mutated after capture by concurrent closure}}
101+
i = Klass() // expected-warning {{'i' mutated after capture by sendable closure}}
102102
// expected-note @-6 {{variable defined here}}
103-
// expected-note @-6 {{variable captured by concurrent closure}}
103+
// expected-note @-6 {{variable captured by sendable closure}}
104104
// expected-note @-6 {{capturing use}}
105105
}
106106

@@ -109,9 +109,9 @@ func testCaseClassInout() {
109109
f {
110110
print(i2)
111111
}
112-
inoutUserKlass(&i2) // expected-warning {{'i2' mutated after capture by concurrent closure}}
112+
inoutUserKlass(&i2) // expected-warning {{'i2' mutated after capture by sendable closure}}
113113
// expected-note @-5 {{variable defined here}}
114-
// expected-note @-5 {{variable captured by concurrent closure}}
114+
// expected-note @-5 {{variable captured by sendable closure}}
115115
// expected-note @-5 {{capturing use}}
116116
}
117117

@@ -154,9 +154,9 @@ func testCaseNonTrivialValue() {
154154
// We only emit a warning here since we use the last write.
155155
//
156156
// TODO: Should we emit for all writes?
157-
i.i.addOne() // expected-warning {{'i' mutated after capture by concurrent closure}}
157+
i.i.addOne() // expected-warning {{'i' mutated after capture by sendable closure}}
158158
// expected-note @-14 {{variable defined here}}
159-
// expected-note @-14 {{variable captured by concurrent closure}}
159+
// expected-note @-14 {{variable captured by sendable closure}}
160160
// expected-note @-14 {{capturing use}}
161161
// expected-note @-14 {{capturing use}}
162162
// expected-note @-14 {{capturing use}}
@@ -170,9 +170,9 @@ func testCaseNonTrivialValueInout() {
170170
}
171171

172172
// We only emit a warning here since we use the last write.
173-
inoutUserOptKlass(&i.k) // expected-warning {{'i' mutated after capture by concurrent closure}}
173+
inoutUserOptKlass(&i.k) // expected-warning {{'i' mutated after capture by sendable closure}}
174174
// expected-note @-8 {{variable defined here}}
175-
// expected-note @-8 {{variable captured by concurrent closure}}
175+
// expected-note @-8 {{variable captured by sendable closure}}
176176
// expected-note @-8 {{capturing use}}
177177
// expected-note @-8 {{capturing use}}
178178
}
@@ -190,9 +190,9 @@ func testCaseAddressOnlyAllocBoxToStackable<T : MyProt & Sendable>(i : T) {
190190
}
191191

192192
// TODO: Make sure we emit these once we support address only types!
193-
inoutUserOptKlass(&i2.k) // xpected-warning {{'i2' mutated after capture by concurrent closure}}
193+
inoutUserOptKlass(&i2.k) // xpected-warning {{'i2' mutated after capture by sendable closure}}
194194
// xpected-note @-8 {{variable defined here}}
195-
// xpected-note @-8 {{variable captured by concurrent closure}}
195+
// xpected-note @-8 {{variable captured by sendable closure}}
196196
// xpected-note @-8 {{capturing use}}
197197
// xpected-note @-8 {{capturing use}}
198198
}
@@ -208,9 +208,9 @@ func testCaseAddressOnlyNoAllocBoxToStackable<T : MyProt & Sendable>(i : T) {
208208
}
209209

210210
// TODO: Make sure we emit these once we support address only types!
211-
inoutUserOptKlass(&i2.k) // xpected-warning {{'i2' mutated after capture by concurrent closure}}
211+
inoutUserOptKlass(&i2.k) // xpected-warning {{'i2' mutated after capture by sendable closure}}
212212
// xpected-note @-8 {{variable defined here}}
213-
// xpected-note @-8 {{variable captured by concurrent closure}}
213+
// xpected-note @-8 {{variable captured by sendable closure}}
214214
// xpected-note @-8 {{capturing use}}
215215
// xpected-note @-8 {{capturing use}}
216216
}

0 commit comments

Comments
 (0)