mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix up the userdocs index
A few docs weren't added to the index, re-run the generation and fix the test to actually run in order to catch future issues.
This commit is contained in:
@@ -56,6 +56,7 @@ GROUP(ExclusivityViolation,none,"exclusivity-violation")
|
||||
GROUP(ExistentialAny,none,"existential-any")
|
||||
GROUP(ExistentialMemberAccess,none,"existential-member-access-limitations")
|
||||
GROUP(ExistentialType,none,"existential-type")
|
||||
GROUP(ExplicitSendable,DefaultIgnoreWarnings,"explicit-sendable-annotations")
|
||||
GROUP(ImplementationOnlyDeprecated,none,"implementation-only-deprecated")
|
||||
GROUP(IsolatedConformances,none,"isolated-conformances")
|
||||
GROUP(MemberImportVisibility,none,"member-import-visibility")
|
||||
@@ -87,7 +88,6 @@ GROUP(TemporaryPointers,none,"temporary-pointers")
|
||||
GROUP(TrailingClosureMatching,none,"trailing-closure-matching")
|
||||
GROUP(UnknownWarningGroup,none,"unknown-warning-group")
|
||||
GROUP(WeakMutability,none,"weak-mutability")
|
||||
GROUP(ExplicitSendable,DefaultIgnoreWarnings,"explicit-sendable-annotations")
|
||||
|
||||
GROUP_LINK(PerformanceHints,ExistentialType)
|
||||
GROUP_LINK(PerformanceHints,ReturnTypeImplicitCopy)
|
||||
|
||||
@@ -31,13 +31,17 @@ Or upgrade all warnings except deprecated declaration to errors:
|
||||
- <doc:string-interpolation-conformance>
|
||||
- <doc:deprecated-declaration>
|
||||
- <doc:implementation-only-deprecated>
|
||||
- <doc:dynamic-exclusivity>
|
||||
- <doc:embedded-restrictions>
|
||||
- <doc:explicit-sendable-annotations>
|
||||
- <doc:preconcurrency-import>
|
||||
- <doc:foreign-reference-type>
|
||||
- <doc:clang-declaration-import>
|
||||
- <doc:isolated-conformances>
|
||||
- <doc:error-in-future-swift-version>
|
||||
- <doc:module-version-missing>
|
||||
- <doc:result-builder-methods>
|
||||
- <doc:semantic-copies>
|
||||
- <doc:strict-language-features>
|
||||
- <doc:strict-memory-safety>
|
||||
- <doc:unknown-warning-group>
|
||||
@@ -53,8 +57,11 @@ Or upgrade all warnings except deprecated declaration to errors:
|
||||
- <doc:string-interpolation-conformance>
|
||||
- <doc:deprecated-declaration>
|
||||
- <doc:implementation-only-deprecated>
|
||||
- <doc:dynamic-exclusivity>
|
||||
- <doc:embedded-restrictions>
|
||||
- <doc:explicit-sendable-annotations>
|
||||
- <doc:preconcurrency-import>
|
||||
- <doc:foreign-reference-type>
|
||||
- <doc:clang-declaration-import>
|
||||
- <doc:isolated-conformances>
|
||||
- <doc:error-in-future-swift-version>
|
||||
@@ -69,6 +76,7 @@ Or upgrade all warnings except deprecated declaration to errors:
|
||||
- <doc:conformance-isolation>
|
||||
- <doc:protocol-type-non-conformance>
|
||||
- <doc:result-builder-methods>
|
||||
- <doc:semantic-copies>
|
||||
- <doc:sendable-metatypes>
|
||||
- <doc:sending-closure-risks-data-race>
|
||||
- <doc:sending-risks-data-race>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Dynamic Exclusivity (Experimental Diagnostics)
|
||||
# Dynamic exclusivity (DynamicExclusivity)
|
||||
|
||||
TODO explain
|
||||
Experimental
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
# Explicit Sendable annotations on public type declarations
|
||||
# Explicit `Sendable` annotations on public type declarations (ExplicitSendable)
|
||||
|
||||
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.
|
||||
Adds a warning for any public types without a `Sendable` annotation.
|
||||
|
||||
## Overview
|
||||
|
||||
The Swift compiler would emit a warning if a public type has none of the following:
|
||||
|
||||
When enabled, the compiler will emit a warning if a public type has none of the following:
|
||||
- A conformance to `Sendable` protocol;
|
||||
- An unavailable conformance to `Sendable` protocol;
|
||||
- `~Sendable` conformance to suppress the inference.
|
||||
|
||||
Let's consider a simple public type without any Senable annotations:
|
||||
|
||||
For example, given a simple public type:
|
||||
```
|
||||
public struct S {
|
||||
let x: Int
|
||||
}
|
||||
```
|
||||
|
||||
When compiling with `-Wwarning ExplicitSendable` the following warning is going to be produced by the Swift compiler:
|
||||
|
||||
As it has no `Sendable` annotations, this diagnostic group will add the following warning:
|
||||
```
|
||||
1 | public struct S {
|
||||
| |- warning: public struct 'S' does not specify whether it is 'Sendable' or not [#ExplicitSendable]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Semantic Copies (Experimental Diagnostics)
|
||||
# Semantic copies (SemanticCopies)
|
||||
|
||||
TODO explain
|
||||
Experimental
|
||||
|
||||
@@ -66,7 +66,7 @@ let topicsHeader = "\n\n## Topics\n"
|
||||
let swiftIncludeDir = "include/swift"
|
||||
|
||||
let groupsFileName = "\(swiftIncludeDir)/AST/DiagnosticGroups.def"
|
||||
let groupRegex = /GROUP\((?<name>[a-zA-Z]+), "(?<file>.+)"\)/
|
||||
let groupRegex = /GROUP\((?<name>[a-zA-Z]+),[^,]+,"(?<file>.+)"\)/
|
||||
|
||||
let featuresFileName = "\(swiftIncludeDir)/Basic/Features.def"
|
||||
let featuresRegex = /UPCOMING_FEATURE\((?<name>[a-zA-Z]+), .+\)/
|
||||
@@ -95,17 +95,17 @@ do {
|
||||
}
|
||||
|
||||
func generateIndex() throws {
|
||||
let groupsWithWarnings = try groupNamesWithWarnings()
|
||||
let docs = try retrieveDocs(groupsWithWarnings).sorted { a, b in
|
||||
return a.title < b.title
|
||||
}
|
||||
|
||||
let groupsHandle = try createIndex(name: groupsDocFileName, header: groupsHeader)
|
||||
defer { try? groupsHandle.close() }
|
||||
|
||||
let featuresHandle = try createIndex(name: featuresDocFileName, header: featuresHeader)
|
||||
defer { try? featuresHandle.close() }
|
||||
|
||||
let groupsWithWarnings = try groupNamesWithWarnings()
|
||||
let docs = try retrieveDocs(groupsWithWarnings).sorted { a, b in
|
||||
return a.title < b.title
|
||||
}
|
||||
|
||||
try groupsHandle.write(contentsOf: "\n\n## Groups with warnings\n".data(using: .utf8)!)
|
||||
for doc in docs where doc.kind == .groupWithWarnings {
|
||||
let ref = "- <doc:\(doc.name.dropLast(3))>\n"
|
||||
|
||||
@@ -10,6 +10,5 @@
|
||||
# RUN: %host-build-swift -swift-version 5 -enable-upcoming-feature BareSlashRegexLiterals %swift_src_root/utils/generate-doc-index.swift -o %t/generate-doc-index
|
||||
# RUN: %t/generate-doc-index %swift_src_root %t
|
||||
|
||||
# RUN: diff -u %swift_src_root/userdocs/diagnostics/diagnostic-descriptions.md %t/diagnostic-descriptions.md
|
||||
# RUN: diff -u %swift_src_root/userdocs/diagnostics/diagnostic-groups.md %t/diagnostic-groups.md
|
||||
# RUN: diff -u %swift_src_root/userdocs/diagnostics/upcoming-language-features.md %t/upcoming-language-features.md
|
||||
|
||||
@@ -138,6 +138,9 @@ config.swift_stdlib_enable_objc_interop = "@SWIFT_STDLIB_ENABLE_OBJC_INTEROP@" =
|
||||
# Configured in DarwinSDKs.cmake
|
||||
config.freestanding_sdk_name = "@SWIFT_SDK_FREESTANDING_LIB_SUBDIR@"
|
||||
|
||||
if '@SWIFT_BUILD_SWIFT_SYNTAX@' == 'TRUE':
|
||||
config.available_features.add('swift_swift_parser')
|
||||
|
||||
config.swift_sdks = "@SWIFT_SDKS@".split(";")
|
||||
|
||||
# Let the main config do the real work.
|
||||
|
||||
Reference in New Issue
Block a user