Skip to content

Commit ba04e5d

Browse files
authored
Merge pull request #85026 from bnbarham/user-doc-cleanup
Cleanup user docs
2 parents a841ab0 + 55f61a8 commit ba04e5d

31 files changed

+378
-223
lines changed

include/swift/AST/DiagnosticGroups.def

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ GROUP(ActorIsolatedCall, "actor-isolated-call")
4444
GROUP(AlwaysAvailableDomain, "always-available-domain")
4545
GROUP(AvailabilityUnrecognizedName, "availability-unrecognized-name")
4646
GROUP(ClangDeclarationImport, "clang-declaration-import")
47+
GROUP(CompilationCaching, "compilation-caching")
4748
GROUP(ConformanceIsolation, "conformance-isolation")
4849
GROUP(DeprecatedDeclaration, "deprecated-declaration")
4950
GROUP(DynamicCallable, "dynamic-callable-requirements")
@@ -52,6 +53,7 @@ GROUP(ErrorInFutureSwiftVersion, "error-in-future-swift-version")
5253
GROUP(ExclusivityViolation, "exclusivity-violation")
5354
GROUP(ExistentialAny, "existential-any")
5455
GROUP(ExistentialMemberAccess, "existential-member-access-limitations")
56+
GROUP(ExistentialType, "existential-type")
5557
GROUP(ImplementationOnlyDeprecated, "implementation-only-deprecated")
5658
GROUP(IsolatedConformances, "isolated-conformances")
5759
GROUP(MemberImportVisibility, "member-import-visibility")
@@ -63,27 +65,30 @@ GROUP(MutableGlobalVariable, "mutable-global-variable")
6365
GROUP(NominalTypes, "nominal-types")
6466
GROUP(NonisolatedNonsendingByDefault, "nonisolated-nonsending-by-default")
6567
GROUP(OpaqueTypeInference, "opaque-type-inference")
68+
GROUP(PerformanceHints, "performance-hints")
6669
GROUP(PreconcurrencyImport, "preconcurrency-import")
6770
GROUP(PropertyWrappers, "property-wrapper-requirements")
6871
GROUP(ProtocolTypeNonConformance, "protocol-type-non-conformance")
72+
GROUP(RegionIsolation, "region-isolation")
6973
GROUP(ResultBuilderMethods, "result-builder-methods")
74+
GROUP(ReturnTypeImplicitCopy, "return-type-implicit-copy")
7075
GROUP(SendableClosureCaptures, "sendable-closure-captures")
7176
GROUP(SendableMetatypes, "sendable-metatypes")
77+
GROUP(SendingClosureRisksDataRace, "sending-closure-risks-data-race")
7278
GROUP(SendingRisksDataRace, "sending-risks-data-race")
7379
GROUP(StrictLanguageFeatures, "strict-language-features")
7480
GROUP(StrictMemorySafety, "strict-memory-safety")
7581
GROUP(StringInterpolationConformance, "string-interpolation-conformance")
7682
GROUP(TemporaryPointers, "temporary-pointers")
7783
GROUP(TrailingClosureMatching, "trailing-closure-matching")
7884
GROUP(UnknownWarningGroup, "unknown-warning-group")
79-
GROUP(CompilationCaching, "compilation-caching")
8085
GROUP(WeakMutability, "weak-mutability")
8186

82-
GROUP(PerformanceHints, "performance-hints")
83-
GROUP(ReturnTypeImplicitCopy, "return-type-implicit-copy")
84-
GROUP_LINK(PerformanceHints, ReturnTypeImplicitCopy)
85-
GROUP(ExistentialType, "existential-type")
8687
GROUP_LINK(PerformanceHints, ExistentialType)
88+
GROUP_LINK(PerformanceHints, ReturnTypeImplicitCopy)
89+
90+
GROUP_LINK(RegionIsolation, SendingClosureRisksDataRace)
91+
GROUP_LINK(RegionIsolation, SendingRisksDataRace)
8792

8893
#define UNDEFINE_DIAGNOSTIC_GROUPS_MACROS
8994
#include "swift/AST/DefineDiagnosticGroupsMacros.h"

include/swift/AST/DiagnosticsSIL.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ NOTE(regionbasedisolation_typed_tns_passed_to_sending, none,
10751075
"causing races inbetween %0 uses and uses reachable from the callee",
10761076
(StringRef, Type))
10771077

1078-
ERROR(regionbasedisolation_typed_tns_passed_sending_closure, none,
1078+
GROUPED_ERROR(regionbasedisolation_typed_tns_passed_sending_closure, SendingClosureRisksDataRace, none,
10791079
"passing closure as a 'sending' parameter risks causing data races between %0 and concurrent execution of the closure",
10801080
(StringRef))
10811081
NOTE(regionbasedisolation_typed_tns_passed_to_sending_closure_helper_have_value, none,

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/

0 commit comments

Comments
 (0)