Diagnostic groups
Detailed explanations for various compiler diagnostics.
Overview
Diagnostic groups collect some number of diagnostics together under a common group name. This allows for extra documentation to help explain relevant language concepts, as well as the ability to control the behavior of warnings in a more precise manner (when that group contains warnings):
-Werror <group>- upgrades warnings in the specified group to errors-Wwarning <group>- indicates that warnings in the specified group should remain warnings, even if they were previously upgraded to errors
As a concrete example, to upgrade deprecated declaration warnings to errors:
-Werror DeprecatedDeclarationOr upgrade all warnings except deprecated declaration to errors:
-warnings-as-errors -Wwarning DeprecatedDeclarationGroups with warnings
Argument matching for trailing closures (TrailingClosureMatching)
Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)
Deprecated implementation-only imports (ImplementationOnlyDeprecated)
Explicit `Sendable` annotations on public type declarations (ExplicitSendable)
Implicit strong captures of weak capture list items (ImplicitStrongCapture)
Imported Clang declaration warnings (ClangDeclarationImport)
Migrating away from experimental suppressed associated types (OldSuppressedAssociatedTypes)
Option obsoleted by module selectors (OptionObsoletedByModuleSelectors)
Public imports of project-internal modules (PublicImportOfProjectInternalModule)
Unavailable Sendable conformance (UnavailableSendableConformance)
Unused throwing unstructured task creation (NoUseUnstructuredThrowingTask)
Topics
@dynamicCallable implementation requirements (DynamicCallable)Add @preconcurrency import (AddPreconcurrencyImport)Always enabled availability domains (AlwaysAvailableDomain)Argument matching for trailing closures (TrailingClosureMatching)Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)Captures in a `@Sendable` closure (SendableClosureCaptures)Compilation caching (CompilationCaching)Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)Cross-isolation data race (RegionIsolationCrossIsolationDataRace)Deprecated declaration warnings (DeprecatedDeclaration)Deprecated implementation-only imports (ImplementationOnlyDeprecated)Dynamic exclusivity (DynamicExclusivity)Embedded Swift language restrictions (EmbeddedRestrictions)Existential Types and Performance (ExistentialType)Explicit `Sendable` annotations on public type declarations (ExplicitSendable)Extraneous @preconcurrency imports (PreconcurrencyImport)Foreign reference types (ForeignReferenceType)Implicit Copy On Return (ReturnTypeImplicitCopy)Implicit strong captures of weak capture list items (ImplicitStrongCapture)Imported Clang declaration warnings (ClangDeclarationImport)Inconsistent import access level (InconsistentImportAccess)Isolated conformances (IsolatedConformances)Language mode and tools version (ErrorInFutureSwiftVersion)Migrating away from experimental suppressed associated types (OldSuppressedAssociatedTypes)Missing module for canImport (CanImportMissingModule)Missing module on known path from a dependency (MissingModuleOnKnownPaths)Missing module version (ModuleVersionMissing)Module not testable (ModuleNotTestable)Module self-import (ModuleSelfImport)Multiple inheritance (MultipleInheritance)Nominal types (NominalTypes)OSLog module (OSLog)Option obsoleted by module selectors (OptionObsoletedByModuleSelectors)Overlapping accesses, but operation requires exclusive access (ExclusivityViolation)Performance Hints (PerformanceHints)Property wrapper implementation requirements (PropertyWrappers)Protocol conformances crossing into actor-isolated code (ConformanceIsolation)Protocol types cannot conform to protocols (ProtocolTypeNonConformance)Public imports of project-internal modules (PublicImportOfProjectInternalModule)Result builder methods (ResultBuilderMethods)SPI import ignored (SPIImportIgnored)Semantic copies (SemanticCopies)Sendable metatypes (SendableMetatypes)Sending closure risks causing data races (SendingClosureRisksDataRace)Sending value risks causing data races (SendingRisksDataRace)Strict language feature enablement (StrictLanguageFeatures)Strict memory safety (StrictMemorySafety)Temporary pointers (TemporaryPointers)Unavailable Sendable conformance (UnavailableSendableConformance)Underlying type inference for opaque result types (OpaqueTypeInference)Unknown region isolation pattern (RegionIsolationUnknownPattern)Unknown warning group (UnknownWarningGroup)Unnecessary effect markers (UnnecessaryEffectMarker)Unnecessary unsafe (UnnecessaryUnsafe)Unrecognized availability platforms (AvailabilityUnrecognizedName)Unsafe mutable global and static variables (MutableGlobalVariable)Unsupported scoped import (UnsupportedScopedImport)Untyped throws (UntypedThrows)Unused import access level (UnusedImportAccess)Unused throwing unstructured task creation (NoUseUnstructuredThrowingTask)Unused values (NoUsage)Use anyAppleOS availability (UseAnyAppleOSAvailability)Useless availability check (UselessAvailabilityCheck)Useless conditional statement (UselessConditionalStatement)Using protocol members with references to `Self` or `Self`-rooted associated types (ExistentialMemberAccess)