diff --git a/include/swift/AST/DiagnosticGroups.def b/include/swift/AST/DiagnosticGroups.def index 2f0c3e31ca12e..6e3a8c8dae0c8 100644 --- a/include/swift/AST/DiagnosticGroups.def +++ b/include/swift/AST/DiagnosticGroups.def @@ -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) diff --git a/userdocs/diagnostics/diagnostic-groups.md b/userdocs/diagnostics/diagnostic-groups.md index df0fd6710e979..1a19021334a47 100644 --- a/userdocs/diagnostics/diagnostic-groups.md +++ b/userdocs/diagnostics/diagnostic-groups.md @@ -31,13 +31,17 @@ Or upgrade all warnings except deprecated declaration to errors: - - - +- - +- - +- - - - - - +- - - - @@ -53,8 +57,11 @@ Or upgrade all warnings except deprecated declaration to errors: - - - +- - +- - +- - - - @@ -69,6 +76,7 @@ Or upgrade all warnings except deprecated declaration to errors: - - - +- - - - diff --git a/userdocs/diagnostics/dynamic-exclusivity.md b/userdocs/diagnostics/dynamic-exclusivity.md index 86ef66ad23cf6..5fca23f62720e 100644 --- a/userdocs/diagnostics/dynamic-exclusivity.md +++ b/userdocs/diagnostics/dynamic-exclusivity.md @@ -1,3 +1,3 @@ -# Dynamic Exclusivity (Experimental Diagnostics) +# Dynamic exclusivity (DynamicExclusivity) -TODO explain +Experimental diff --git a/userdocs/diagnostics/explicit-sendable-annotations.md b/userdocs/diagnostics/explicit-sendable-annotations.md index 6e46368c373e7..74da3b1576026 100644 --- a/userdocs/diagnostics/explicit-sendable-annotations.md +++ b/userdocs/diagnostics/explicit-sendable-annotations.md @@ -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] diff --git a/userdocs/diagnostics/semantic-copies.md b/userdocs/diagnostics/semantic-copies.md index 3d415ecb75fcc..96c9bdf77625d 100644 --- a/userdocs/diagnostics/semantic-copies.md +++ b/userdocs/diagnostics/semantic-copies.md @@ -1,3 +1,3 @@ -# Semantic Copies (Experimental Diagnostics) +# Semantic copies (SemanticCopies) -TODO explain +Experimental diff --git a/utils/generate-doc-index.swift b/utils/generate-doc-index.swift index 631e0e69c4e9a..c5ed36d05a8fc 100755 --- a/utils/generate-doc-index.swift +++ b/utils/generate-doc-index.swift @@ -66,7 +66,7 @@ let topicsHeader = "\n\n## Topics\n" let swiftIncludeDir = "include/swift" let groupsFileName = "\(swiftIncludeDir)/AST/DiagnosticGroups.def" -let groupRegex = /GROUP\((?[a-zA-Z]+), "(?.+)"\)/ +let groupRegex = /GROUP\((?[a-zA-Z]+),[^,]+,"(?.+)"\)/ let featuresFileName = "\(swiftIncludeDir)/Basic/Features.def" let featuresRegex = /UPCOMING_FEATURE\((?[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 = "- \n" diff --git a/validation-test/docs/userdoc_indices.test b/validation-test/docs/userdoc_indices.test index 368c1e89848a8..ef7f8b08d5c68 100644 --- a/validation-test/docs/userdoc_indices.test +++ b/validation-test/docs/userdoc_indices.test @@ -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 diff --git a/validation-test/lit.site.cfg.in b/validation-test/lit.site.cfg.in index b3e779647178d..1a009d1618b6e 100644 --- a/validation-test/lit.site.cfg.in +++ b/validation-test/lit.site.cfg.in @@ -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.