You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: userdocs/diagnostics/explicit-sendable-annotations.md
+5-8Lines changed: 5 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,22 @@
1
-
# Explicit Sendable annotations on public type declarations
1
+
# Explicit `Sendable` annotations on public type declarations (ExplicitSendable)
2
2
3
-
If a public type doesn't have an explicit Sendable or non-Sendable annotation it is sometimes hard to discern whether that is intentional or not, especially if a type could be Sendable.
3
+
Adds a warning for any public types without a `Sendable` annotation.
4
4
5
5
## Overview
6
6
7
-
The Swift compiler would emit a warning if a public type has none of the following:
8
-
7
+
When enabled, the compiler will emit a warning if a public type has none of the following:
9
8
- A conformance to `Sendable` protocol;
10
9
- An unavailable conformance to `Sendable` protocol;
11
10
-`~Sendable` conformance to suppress the inference.
12
11
13
-
Let's consider a simple public type without any Senable annotations:
14
-
12
+
For example, given a simple public type:
15
13
```
16
14
public struct S {
17
15
let x: Int
18
16
}
19
17
```
20
18
21
-
When compiling with `-Wwarning ExplicitSendable` the following warning is going to be produced by the Swift compiler:
22
-
19
+
As it has no `Sendable` annotations, this diagnostic group will add the following warning:
23
20
```
24
21
1 | public struct S {
25
22
| |- warning: public struct 'S' does not specify whether it is 'Sendable' or not [#ExplicitSendable]
0 commit comments