Skip to content

Commit 55f61a8

Browse files
committed
Re-generate diagnostics index and cleanup old notes
This is mostly just cleanup: 1. Removes `diagnostic-descriptions.md` since it isn't used any more 2. Adds the group name to all the old notes files 3. Removes trailing whitespace 4. Adds "See Also" sections for notes that have links
1 parent 47bed40 commit 55f61a8

28 files changed

+204
-104
lines changed

userdocs/diagnostics/actor-isolated-call.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Calling an actor-isolated method from a synchronous nonisolated context
1+
# Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)
2+
3+
## Overview
24

35
Accessing actor-isolated state from outside the actor can cause data races in your program. Resolve this error by calling actor-isolated functions on the actor.
46

userdocs/diagnostics/conformance-isolation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Protocol conformances crossing into actor-isolated code
1+
# Protocol conformances crossing into actor-isolated code (ConformanceIsolation)
2+
3+
## Overview
24

35
Protocol conformances crossing into actor-isolated code can cause data races in your program. Resolve this error by ensuring access to isolated state is always done within the actor.
46

userdocs/diagnostics/diagnostic-descriptions.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

userdocs/diagnostics/diagnostic-groups.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<!-- This file is auto-generated via `swift swift/utils/generate-doc-index.swift` -->
44

5-
Diagnostic groups allow controlling the behavior of warnings in a more precise manner.
5+
Detailed explanations for various compiler diagnostics.
66

77

88
## Overview
99

1010
Diagnostic groups collect some number of diagnostics together under a common group name. This allows
1111
for extra documentation to help explain relevant language concepts, as well as the ability to
12-
control the behavior of warnings in a more precise manner:
12+
control the behavior of warnings in a more precise manner (when that group contains warnings):
1313
- `-Werror <group>` - upgrades warnings in the specified group to errors
1414
- `-Wwarning <group>` - indicates that warnings in the specified group should remain warnings, even
1515
if they were previously upgraded to errors
@@ -24,18 +24,59 @@ Or upgrade all warnings except deprecated declaration to errors:
2424
-warnings-as-errors -Wwarning DeprecatedDeclaration
2525
```
2626

27+
## Groups with warnings
28+
- <doc:always-available-domain>
29+
- <doc:trailing-closure-matching>
30+
- <doc:compilation-caching>
31+
- <doc:string-interpolation-conformance>
32+
- <doc:deprecated-declaration>
33+
- <doc:implementation-only-deprecated>
34+
- <doc:embedded-restrictions>
35+
- <doc:preconcurrency-import>
36+
- <doc:clang-declaration-import>
37+
- <doc:isolated-conformances>
38+
- <doc:error-in-future-swift-version>
39+
- <doc:module-version-missing>
40+
- <doc:result-builder-methods>
41+
- <doc:strict-language-features>
42+
- <doc:strict-memory-safety>
43+
- <doc:unknown-warning-group>
2744

28-
## Topics
2945

46+
## Topics
47+
- <doc:dynamic-callable-requirements>
48+
- <doc:always-available-domain>
49+
- <doc:trailing-closure-matching>
50+
- <doc:actor-isolated-call>
51+
- <doc:sendable-closure-captures>
3052
- <doc:compilation-caching>
53+
- <doc:string-interpolation-conformance>
3154
- <doc:deprecated-declaration>
3255
- <doc:implementation-only-deprecated>
3356
- <doc:embedded-restrictions>
3457
- <doc:preconcurrency-import>
3558
- <doc:clang-declaration-import>
59+
- <doc:isolated-conformances>
60+
- <doc:error-in-future-swift-version>
3661
- <doc:missing-module-on-known-paths>
3762
- <doc:module-version-missing>
63+
- <doc:module-not-testable>
64+
- <doc:multiple-inheritance>
65+
- <doc:nominal-types>
66+
- <doc:exclusivity-violation>
67+
- <doc:performance-hints>
68+
- <doc:property-wrapper-requirements>
69+
- <doc:conformance-isolation>
70+
- <doc:protocol-type-non-conformance>
71+
- <doc:result-builder-methods>
72+
- <doc:sendable-metatypes>
73+
- <doc:sending-closure-risks-data-race>
74+
- <doc:sending-risks-data-race>
3875
- <doc:strict-language-features>
3976
- <doc:strict-memory-safety>
77+
- <doc:temporary-pointers>
78+
- <doc:opaque-type-inference>
4079
- <doc:unknown-warning-group>
4180
- <doc:availability-unrecognized-name>
81+
- <doc:mutable-global-variable>
82+
- <doc:existential-member-access-limitations>

userdocs/diagnostics/diagnostics.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ Documentation on diagnostics emitted by the compiler and settings that control t
99

1010
## Topics
1111

12-
- <doc:diagnostic-descriptions>
1312
- <doc:diagnostic-groups>
1413
- <doc:upcoming-language-features>

userdocs/diagnostics/dynamic-callable-requirements.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# @dynamicCallable Implementation Requirements
1+
# @dynamicCallable implementation requirements (DynamicCallable)
2+
3+
## Overview
4+
25
If a type is marked with the `@dynamicCallable` attribute, it must provide a valid implementation of `dynamicallyCall(withArguments:)`, `dynamicallyCall(withKeywordArguments:)`, or both. If it fails to do so, an error will be reported at compile-time. Note that an implementation of `dynamicallyCall(withKeywordArguments:)` is required to support calls with keyword arguments.
36

47
To be considered valid, an implementation of `dynamicallyCall(withArguments:)` must:
@@ -10,4 +13,8 @@ To be considered valid, an implementation of `dynamicallyCall(withKeywordArgumen
1013
- Be an instance method. `static` or `class` implementations are not allowed.
1114
- Have an argument type which conforms to the `ExpressibleByDictionaryLiteral` protocol. This can be `Dictionary`, `KeyValuePairs` (which may be used to support duplicated keyword arguments), or some other conforming type.
1215
- The `Key` associated type of the argument type must conform to the `ExpressibleByStringLiteral` protocol. This type is used to represent the dynamic argument keywords.
13-
- The `Value` associated type of the argument type and the return type of `dynamicallyCall(withKeywordArguments:)` may be any valid types.
16+
- The `Value` associated type of the argument type and the return type of `dynamicallyCall(withKeywordArguments:)` may be any valid types.
17+
18+
## See also
19+
20+
- [SE-0216](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0216-dynamic-callable.md)
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Language mode and tools version
1+
# Language mode and tools version (ErrorInFutureSwiftVersion)
2+
3+
## Overview
24

35
Swift language mode and Swift compiler tools version are distinct concepts. One compiler version can support multiple language modes.
46

@@ -7,6 +9,6 @@ There are two related kinds of "Swift version" that are distinct:
79
* Swift tools version: the version number of the compiler itself. For example, the Swift 5.6 compiler was introduced in March 2022.
810
* Swift language mode version: the language mode version with which we are providing source compatibility. For example, the Swift 5 language mode is the most current language mode version supported by Swift tools version 5.10.
911

10-
The Swift tools support multiple Swift language modes. All Swift tools versions between 5.0 and 5.10 support three Swift language modes: 4, 4.2, and 5. The Swift 6.0 compiler supports four Swift language modes: 4, 4.2, 5, and 6. Swift language modes are opt-in; when you use a tools version that supports a new language mode, your code will not build with the new language mode until you set that language mode in your build settings with `-swift-version X`.
12+
The Swift tools support multiple Swift language modes. All Swift tools versions between 5.0 and 5.10 support three Swift language modes: 4, 4.2, and 5. The Swift 6.0 compiler supports four Swift language modes: 4, 4.2, 5, and 6. Swift language modes are opt-in; when you use a tools version that supports a new language mode, your code will not build with the new language mode until you set that language mode in your build settings with `-language-mode X`.
1113

1214
A warning suffixed with `this is an error in the Swift 6 language mode` means that once you migrate to that language mode in your code, the warning will be promoted to an error. These warnings primarily come from enabling upcoming features that are enabled by default in that language mode version, but errors may also be staged in as warnings until the next language mode to maintain source compatibility when fixing compiler bugs.

userdocs/diagnostics/exclusivity-violation.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Overlapping accesses, but operation requires exclusive access
1+
# Overlapping accesses, but operation requires exclusive access (ExclusivityViolation)
2+
3+
## Overview
24

35
Swift requires exclusive access to a variable in order to modify that variable. An error is reported if a program attempts to access a variable while it is already in the process of being accessed via another name. These issues can often be resolved by making a local copy of a variable before modifying it.
46

@@ -58,4 +60,10 @@ var toAppend = numbers
5860
numbers.append(removingFrom: &toAppend)
5961
```
6062

61-
Exclusivity checks play an important role in enforcing memory safety and enabling compiler optimizations. To learn more, see [Swift 5 Exclusivity Enforcement](https://www.swift.org/blog/swift-5-exclusivity/) on the Swift.org blog.
63+
Exclusivity checks play an important role in enforcing memory safety and enabling compiler optimizations. See the Swift.org [blog][exclusivity-enforcement] to learn more.
64+
65+
## See Also
66+
67+
- [Swift 5 exclusivity enforcement][exclusivity-enforcement]
68+
69+
[exclusivity-enforcement]: https://www.swift.org/blog/swift-5-exclusivity/

userdocs/diagnostics/existential-member-access-limitations.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Using Protocol Members with References to `Self` or `Self`-rooted Associated Types
1+
# Using protocol members with references to `Self` or `Self`-rooted associated types (ExistentialMemberAccess)
22

33
Protocol requirements and protocol extension members may be accessed via a conformance constraint on a generic parameter, an opaque result type, or via the protocol type itself:
44

@@ -51,4 +51,16 @@ func duplicateShape(_ shape: Shape) -> Shape {
5151
}
5252
```
5353

54-
Most use cases involving usage of protocol members that fall under the above restriction can instead be supported by constrained generics, opaque result types, or manual type-erasing wrappers. To learn more, see the sections on [protocols](https://docs.swift.org/swift-book/LanguageGuide/Protocols.html), [generics](https://docs.swift.org/swift-book/LanguageGuide/Generics.html), and [opaque types](https://docs.swift.org/swift-book/LanguageGuide/OpaqueTypes.html) in the Language Guide. For a better understanding of existential types in particular, and an in-depth exploration of the relationships among these built-in abstraction models, we recommend reading the [design document for improving the UI of the generics model](https://forums.swift.org/t/improving-the-ui-of-generics/22814).
54+
Most use cases involving usage of protocol members that fall under the above restriction can instead be supported by constrained generics, opaque result types, or manual type-erasing wrappers. To learn more, see the sections on [protocols], [generics], and [opaque types][opaque-types] in the Language Guide. For a better understanding of existential types in particular, and an in-depth exploration of the relationships among these built-in abstraction models, we recommend reading [design document for improving the UI of the generics model][improving-generics-ui].
55+
56+
## See Also
57+
58+
- [Generics][generics]
59+
- [Improving the UI of generics][improving-generics-ui]
60+
- [Opaque Types][opaque-types]
61+
- [Protocols][protocols]
62+
63+
[generics]: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/generics
64+
[improving-generics-ui]: https://forums.swift.org/t/improving-the-ui-of-generics/22814
65+
[opaque-types]: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/opaquetypes
66+
[protocols]: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols

userdocs/diagnostics/implementation-only-deprecated.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
Warnings that identify `import` declarations with the `@_implementationOnly` attribute.
44

5+
56
## Overview
67

78
When applied to `import` declarations, the compiler-internal attribute `@_implementationOnly` attempts prevents declarations from the imported module from being exposed in the ABI or public interface of the dependent module. This attribute became deprecated when support for access levels on `import` declarations was introduced with [SE-0409].
89

9-
One reason `@_implementationOnly import` is deprecated is that it is unsafe when used in modules that are built _without_ [library evolution] enabled. For example, suppose the following code were part of a library named `Foo`:
10+
One reason `@_implementationOnly import` is deprecated is that it is unsafe when used in modules that are built _without_ [library evolution][library-evolution] enabled. For example, suppose the following code were part of a library named `Foo`:
1011

1112
```swift
1213
// Library `Foo`
@@ -19,5 +20,10 @@ public struct Bar {
1920

2021
If `Foo` is not compiled with library evolution, then the memory layout of values of `Bar` must be known at compile time in clients of `Foo`. However, the `@_implementationOnly import` of `ImplementationDetail` prevents clients from being able to look up `Baz` which is a type that contributes to the layout of `Foo`. As a result, the layout of `Foo` will be miscalculated resulting in undefined behavior.
2122

23+
## See Also
24+
25+
- [SE-0409: Access level on imports][SE-0409]
26+
- [Library evolution][library-evolution]
27+
2228
[SE-0409]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md
23-
[library evolution]: https://www.swift.org/blog/library-evolution/
29+
[library-evolution]: https://www.swift.org/blog/library-evolution/

0 commit comments

Comments
 (0)