Skip to content

Commit 8e06293

Browse files
authored
Merge pull request #85875 from bnbarham/fix-up-userdocs
Fix up the userdocs index
2 parents 85d522e + b29a0a9 commit 8e06293

File tree

8 files changed

+27
-20
lines changed

8 files changed

+27
-20
lines changed

include/swift/AST/DiagnosticGroups.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ GROUP(ExclusivityViolation,none,"exclusivity-violation")
5656
GROUP(ExistentialAny,none,"existential-any")
5757
GROUP(ExistentialMemberAccess,none,"existential-member-access-limitations")
5858
GROUP(ExistentialType,none,"existential-type")
59+
GROUP(ExplicitSendable,DefaultIgnoreWarnings,"explicit-sendable-annotations")
5960
GROUP(ImplementationOnlyDeprecated,none,"implementation-only-deprecated")
6061
GROUP(IsolatedConformances,none,"isolated-conformances")
6162
GROUP(MemberImportVisibility,none,"member-import-visibility")
@@ -87,7 +88,6 @@ GROUP(TemporaryPointers,none,"temporary-pointers")
8788
GROUP(TrailingClosureMatching,none,"trailing-closure-matching")
8889
GROUP(UnknownWarningGroup,none,"unknown-warning-group")
8990
GROUP(WeakMutability,none,"weak-mutability")
90-
GROUP(ExplicitSendable,DefaultIgnoreWarnings,"explicit-sendable-annotations")
9191

9292
GROUP_LINK(PerformanceHints,ExistentialType)
9393
GROUP_LINK(PerformanceHints,ReturnTypeImplicitCopy)

userdocs/diagnostics/diagnostic-groups.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ Or upgrade all warnings except deprecated declaration to errors:
3131
- <doc:string-interpolation-conformance>
3232
- <doc:deprecated-declaration>
3333
- <doc:implementation-only-deprecated>
34+
- <doc:dynamic-exclusivity>
3435
- <doc:embedded-restrictions>
36+
- <doc:explicit-sendable-annotations>
3537
- <doc:preconcurrency-import>
38+
- <doc:foreign-reference-type>
3639
- <doc:clang-declaration-import>
3740
- <doc:isolated-conformances>
3841
- <doc:error-in-future-swift-version>
3942
- <doc:module-version-missing>
4043
- <doc:result-builder-methods>
44+
- <doc:semantic-copies>
4145
- <doc:strict-language-features>
4246
- <doc:strict-memory-safety>
4347
- <doc:unknown-warning-group>
@@ -53,8 +57,11 @@ Or upgrade all warnings except deprecated declaration to errors:
5357
- <doc:string-interpolation-conformance>
5458
- <doc:deprecated-declaration>
5559
- <doc:implementation-only-deprecated>
60+
- <doc:dynamic-exclusivity>
5661
- <doc:embedded-restrictions>
62+
- <doc:explicit-sendable-annotations>
5763
- <doc:preconcurrency-import>
64+
- <doc:foreign-reference-type>
5865
- <doc:clang-declaration-import>
5966
- <doc:isolated-conformances>
6067
- <doc:error-in-future-swift-version>
@@ -69,6 +76,7 @@ Or upgrade all warnings except deprecated declaration to errors:
6976
- <doc:conformance-isolation>
7077
- <doc:protocol-type-non-conformance>
7178
- <doc:result-builder-methods>
79+
- <doc:semantic-copies>
7280
- <doc:sendable-metatypes>
7381
- <doc:sending-closure-risks-data-race>
7482
- <doc:sending-risks-data-race>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Dynamic Exclusivity (Experimental Diagnostics)
1+
# Dynamic exclusivity (DynamicExclusivity)
22

3-
TODO explain
3+
Experimental

userdocs/diagnostics/explicit-sendable-annotations.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
# Explicit Sendable annotations on public type declarations
1+
# Explicit `Sendable` annotations on public type declarations (ExplicitSendable)
22

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.
44

55
## Overview
66

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:
98
- A conformance to `Sendable` protocol;
109
- An unavailable conformance to `Sendable` protocol;
1110
- `~Sendable` conformance to suppress the inference.
1211

13-
Let's consider a simple public type without any Senable annotations:
14-
12+
For example, given a simple public type:
1513
```
1614
public struct S {
1715
let x: Int
1816
}
1917
```
2018

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:
2320
```
2421
1 | public struct S {
2522
| |- warning: public struct 'S' does not specify whether it is 'Sendable' or not [#ExplicitSendable]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Semantic Copies (Experimental Diagnostics)
1+
# Semantic copies (SemanticCopies)
22

3-
TODO explain
3+
Experimental

utils/generate-doc-index.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let topicsHeader = "\n\n## Topics\n"
6666
let swiftIncludeDir = "include/swift"
6767

6868
let groupsFileName = "\(swiftIncludeDir)/AST/DiagnosticGroups.def"
69-
let groupRegex = /GROUP\((?<name>[a-zA-Z]+), "(?<file>.+)"\)/
69+
let groupRegex = /GROUP\((?<name>[a-zA-Z]+),[^,]+,"(?<file>.+)"\)/
7070

7171
let featuresFileName = "\(swiftIncludeDir)/Basic/Features.def"
7272
let featuresRegex = /UPCOMING_FEATURE\((?<name>[a-zA-Z]+), .+\)/
@@ -95,17 +95,17 @@ do {
9595
}
9696

9797
func generateIndex() throws {
98+
let groupsWithWarnings = try groupNamesWithWarnings()
99+
let docs = try retrieveDocs(groupsWithWarnings).sorted { a, b in
100+
return a.title < b.title
101+
}
102+
98103
let groupsHandle = try createIndex(name: groupsDocFileName, header: groupsHeader)
99104
defer { try? groupsHandle.close() }
100105

101106
let featuresHandle = try createIndex(name: featuresDocFileName, header: featuresHeader)
102107
defer { try? featuresHandle.close() }
103108

104-
let groupsWithWarnings = try groupNamesWithWarnings()
105-
let docs = try retrieveDocs(groupsWithWarnings).sorted { a, b in
106-
return a.title < b.title
107-
}
108-
109109
try groupsHandle.write(contentsOf: "\n\n## Groups with warnings\n".data(using: .utf8)!)
110110
for doc in docs where doc.kind == .groupWithWarnings {
111111
let ref = "- <doc:\(doc.name.dropLast(3))>\n"

validation-test/docs/userdoc_indices.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@
1010
# RUN: %host-build-swift -swift-version 5 -enable-upcoming-feature BareSlashRegexLiterals %swift_src_root/utils/generate-doc-index.swift -o %t/generate-doc-index
1111
# RUN: %t/generate-doc-index %swift_src_root %t
1212

13-
# RUN: diff -u %swift_src_root/userdocs/diagnostics/diagnostic-descriptions.md %t/diagnostic-descriptions.md
1413
# RUN: diff -u %swift_src_root/userdocs/diagnostics/diagnostic-groups.md %t/diagnostic-groups.md
1514
# RUN: diff -u %swift_src_root/userdocs/diagnostics/upcoming-language-features.md %t/upcoming-language-features.md

validation-test/lit.site.cfg.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ config.swift_stdlib_enable_objc_interop = "@SWIFT_STDLIB_ENABLE_OBJC_INTEROP@" =
138138
# Configured in DarwinSDKs.cmake
139139
config.freestanding_sdk_name = "@SWIFT_SDK_FREESTANDING_LIB_SUBDIR@"
140140

141+
if '@SWIFT_BUILD_SWIFT_SYNTAX@' == 'TRUE':
142+
config.available_features.add('swift_swift_parser')
143+
141144
config.swift_sdks = "@SWIFT_SDKS@".split(";")
142145

143146
# Let the main config do the real work.

0 commit comments

Comments
 (0)