diff --git a/include/swift/AST/DiagnosticGroups.def b/include/swift/AST/DiagnosticGroups.def index fa200714c7b05..9aa58a9d923b8 100644 --- a/include/swift/AST/DiagnosticGroups.def +++ b/include/swift/AST/DiagnosticGroups.def @@ -22,12 +22,12 @@ GROUP(no_group, "") -GROUP(DeprecatedDeclaration, "DeprecatedDeclaration.md") -GROUP(Unsafe, "Unsafe.md") -GROUP(UnknownWarningGroup, "UnknownWarningGroup.md") -GROUP(PreconcurrencyImport, "PreconcurrencyImport.md") -GROUP(StrictLanguageFeatures, "StrictLanguageFeatures.md") -GROUP(ExistentialAny, "ExistentialAny.md") +GROUP(DeprecatedDeclaration, "deprecated-declaration.md") +GROUP(StrictMemorySafety, "strict-memory-safety.md") +GROUP(UnknownWarningGroup, "unknown-warning-group.md") +GROUP(PreconcurrencyImport, "preconcurrency-import.md") +GROUP(StrictLanguageFeatures, "strict-language-features.md") +GROUP(ExistentialAny, "existential-any.md") #define UNDEFINE_DIAGNOSTIC_GROUPS_MACROS #include "swift/AST/DefineDiagnosticGroupsMacros.h" diff --git a/include/swift/AST/DiagnosticsFrontend.def b/include/swift/AST/DiagnosticsFrontend.def index dc5d82d37657a..5bb3bc47b4213 100644 --- a/include/swift/AST/DiagnosticsFrontend.def +++ b/include/swift/AST/DiagnosticsFrontend.def @@ -590,7 +590,7 @@ ERROR(experimental_not_supported_in_production,none, "experimental feature '%0' cannot be enabled in production compiler", (StringRef)) -GROUPED_WARNING(command_line_conflicts_with_strict_safety,Unsafe,none, +GROUPED_WARNING(command_line_conflicts_with_strict_safety,StrictMemorySafety,none, "'%0' is not memory-safe and should not be combined with " "strict memory safety checking", (StringRef)) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 32a8d68d277e2..61a8097156b28 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -8196,7 +8196,7 @@ NOTE(note_use_of_unsafe_conformance_is_unsafe,none, NOTE(note_unsafe_storage,none, "%kindbase1 involves unsafe type %2", (bool, const ValueDecl *, Type)) -GROUPED_WARNING(decl_unsafe_storage,Unsafe,none, +GROUPED_WARNING(decl_unsafe_storage,StrictMemorySafety,none, "%kindbase0 has storage involving unsafe types", (const Decl *)) NOTE(decl_storage_mark_unsafe,none, @@ -8206,11 +8206,11 @@ NOTE(decl_storage_mark_safe,none, "add '@safe' if this type encapsulates the unsafe storage in " "a safe interface", ()) -GROUPED_WARNING(unsafe_superclass,Unsafe,none, +GROUPED_WARNING(unsafe_superclass,StrictMemorySafety,none, "%kindbase0 has superclass involving unsafe type %1", (const ValueDecl *, Type)) -GROUPED_WARNING(conformance_involves_unsafe,Unsafe,none, +GROUPED_WARNING(conformance_involves_unsafe,StrictMemorySafety,none, "conformance of %0 to %kind1 involves unsafe code; use '@unsafe' to " "indicate that the conformance is not memory-safe", (Type, const ValueDecl *)) @@ -8221,15 +8221,15 @@ NOTE(note_type_witness_unsafe,none, "unsafe type %0 cannot satisfy safe associated type %1", (Type, DeclName)) -GROUPED_WARNING(override_safe_with_unsafe,Unsafe,none, +GROUPED_WARNING(override_safe_with_unsafe,StrictMemorySafety,none, "override of safe %0 with unsafe %0", (DescriptiveDeclKind)) -GROUPED_WARNING(preconcurrency_import_unsafe,Unsafe,none, +GROUPED_WARNING(preconcurrency_import_unsafe,StrictMemorySafety,none, "@preconcurrency import is not memory-safe because it can silently " "introduce data races", ()) -GROUPED_WARNING(unsafe_without_unsafe,Unsafe,none, +GROUPED_WARNING(unsafe_without_unsafe,StrictMemorySafety,none, "expression uses unsafe constructs but is not marked with 'unsafe'", ()) -GROUPED_WARNING(for_unsafe_without_unsafe,Unsafe,none, +GROUPED_WARNING(for_unsafe_without_unsafe,StrictMemorySafety,none, "for-in loop uses unsafe constructs but is not marked with 'unsafe'", ()) WARNING(no_unsafe_in_unsafe,none, "no unsafe operations occur within 'unsafe' expression", ()) diff --git a/test/Unsafe/safe.swift b/test/Unsafe/safe.swift index f1d0633399cfd..a41c740d99706 100644 --- a/test/Unsafe/safe.swift +++ b/test/Unsafe/safe.swift @@ -91,9 +91,9 @@ func testUnsafeAsSequenceForEach() { // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{12-12=unsafe }} for _ in uas { } // expected-note{{conformance}} - // expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}}{{7-7=unsafe }} + // expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{7-7=unsafe }} - for _ in unsafe uas { } // expected-warning{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}}{{7-7=unsafe }} + for _ in unsafe uas { } // expected-warning{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{7-7=unsafe }} for unsafe _ in unsafe uas { } // okay } diff --git a/test/Unsafe/safe_argument_suppression.swift b/test/Unsafe/safe_argument_suppression.swift index 1a571607a95ef..4c60ad462265d 100644 --- a/test/Unsafe/safe_argument_suppression.swift +++ b/test/Unsafe/safe_argument_suppression.swift @@ -36,7 +36,7 @@ class NotSafeSubclass: NotSafe { _ = NotSafe[ns] NotSafe.doStatically(NotSafe.self) - ns.stillUnsafe() // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}} + ns.stillUnsafe() // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}} // expected-note@-1{{reference to parameter 'ns' involves unsafe type 'NotSafe'}} // expected-note@-2{{reference to unsafe instance method 'stillUnsafe()'}} } diff --git a/test/Unsafe/unsafe-suppression.swift b/test/Unsafe/unsafe-suppression.swift index eb3c108cb7c1d..a15344dbdd249 100644 --- a/test/Unsafe/unsafe-suppression.swift +++ b/test/Unsafe/unsafe-suppression.swift @@ -21,7 +21,7 @@ class C { class D1: C { // expected-note{{make class 'D1' @unsafe to allow unsafe overrides of safe superclass methods}}{{1-1=@unsafe }} @unsafe - override func method() { } // expected-warning{{override of safe instance method with unsafe instance method [Unsafe]}} + override func method() { } // expected-warning{{override of safe instance method with unsafe instance method [StrictMemorySafety]}} } @unsafe class D2: C { @@ -34,7 +34,7 @@ protocol P { } struct S1: P { - // expected-warning@-1{{conformance of 'S1' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [Unsafe]}}{{12-12=@unsafe }} + // expected-warning@-1{{conformance of 'S1' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{12-12=@unsafe }} @unsafe func protoMethod() { } // expected-note{{unsafe instance method 'protoMethod()' cannot satisfy safe requirement}} } @@ -48,7 +48,7 @@ struct S2: P { struct S3 { } extension S3: P { - // expected-warning@-1{{conformance of 'S3' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [Unsafe]}}{{15-15=@unsafe }} + // expected-warning@-1{{conformance of 'S3' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{15-15=@unsafe }} @unsafe func protoMethod() { } // expected-note{{unsafe instance method 'protoMethod()' cannot satisfy safe requirement}} } @@ -116,12 +116,12 @@ extension UnsafeOuter { var yieldUnsafe: Int { _read { @unsafe let x = 5 - yield x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}} + yield x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}} // expected-note@-1{{reference to unsafe let 'x'}} } _modify { @unsafe var x = 5 - yield &x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}} + yield &x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}} // expected-note@-1{{reference to unsafe var 'x'}} } } @@ -142,9 +142,9 @@ struct UnsafeSequence: @unsafe IteratorProtocol, @unsafe Sequence { } func forEachLoop(us: UnsafeSequence) { - for _ in us { } // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}}{{12-12=unsafe }} + for _ in us { } // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{12-12=unsafe }} // expected-note@-1{{@unsafe conformance of 'UnsafeSequence' to protocol 'Sequence' involves unsafe code}} - // expected-warning@-2{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}} + // expected-warning@-2{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}} for _ in unsafe us { } - // expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}} + // expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}} } diff --git a/test/Unsafe/unsafe.swift b/test/Unsafe/unsafe.swift index 18c644da82366..0b4bbb809de04 100644 --- a/test/Unsafe/unsafe.swift +++ b/test/Unsafe/unsafe.swift @@ -16,7 +16,7 @@ protocol P { @unsafe func g() } -struct XP: P { // expected-warning{{conformance of 'XP' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [Unsafe]}}{{12-12=@unsafe }} +struct XP: P { // expected-warning{{conformance of 'XP' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{12-12=@unsafe }} @unsafe func f() { } // expected-note{{unsafe instance method 'f()' cannot satisfy safe requirement}} @unsafe func g() { } } @@ -30,7 +30,7 @@ protocol Ptrable2 { } extension HasAPointerType: Ptrable2 { } // expected-note{{unsafe type 'HasAPointerType.Ptr' (aka 'PointerType') cannot satisfy safe associated type 'Ptr'}} - // expected-warning@-1{{conformance of 'HasAPointerType' to protocol 'Ptrable2' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [Unsafe]}}{{28-28=@unsafe }} + // expected-warning@-1{{conformance of 'HasAPointerType' to protocol 'Ptrable2' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{28-28=@unsafe }} struct UnsafeXP: @unsafe P { @unsafe func f() { } @@ -44,7 +44,7 @@ protocol MultiP { struct ConformsToMultiP { } -// expected-warning@+1{{conformance of 'ConformsToMultiP' to protocol 'MultiP' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [Unsafe]}}{{29-29=@unsafe }} +// expected-warning@+1{{conformance of 'ConformsToMultiP' to protocol 'MultiP' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{29-29=@unsafe }} extension ConformsToMultiP: MultiP { // expected-note@-1{{unsafe type 'UnsafeSuper' cannot satisfy safe associated type 'Ptr'}} @unsafe func f() -> UnsafeSuper { @@ -74,7 +74,7 @@ class Super { } class Sub: Super { // expected-note{{make class 'Sub' @unsafe to allow unsafe overrides of safe superclass methods}}{{1-1=@unsafe }} - @unsafe override func f() { } // expected-warning{{override of safe instance method with unsafe instance method [Unsafe]}} + @unsafe override func f() { } // expected-warning{{override of safe instance method with unsafe instance method [StrictMemorySafety]}} @unsafe override func g() { } } @@ -117,7 +117,7 @@ class ExclusivityChecking { func f() { } }; -// expected-warning@+1{{class 'UnsafeSub' has superclass involving unsafe type 'UnsafeSuper' [Unsafe]}}{{1-1=@unsafe }} +// expected-warning@+1{{class 'UnsafeSub' has superclass involving unsafe type 'UnsafeSuper' [StrictMemorySafety]}}{{1-1=@unsafe }} class UnsafeSub: UnsafeSuper { } // ----------------------------------------------------------------------- @@ -129,13 +129,13 @@ struct BufferThingy { } func testConstruction() { - let _ = BufferThingy(count: 17) // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}}{{11-11=unsafe }} + let _ = BufferThingy(count: 17) // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{11-11=unsafe }} // expected-note@-1{{reference to unsafe initializer 'init(count:)'}} } func testRHS(b: Bool, x: Int) { @unsafe let limit = 17 - if b && x > limit { // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [Unsafe]}}{{6-6=unsafe }} + if b && x > limit { // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{6-6=unsafe }} // expected-note@-1{{reference to unsafe let 'limit'}} } } @@ -171,7 +171,7 @@ typealias SuperUnsafe = UnsafeSuper @unsafe typealias SuperUnsafe2 = UnsafeSuper -// expected-warning@+3{{enum 'HasUnsafeThings' has storage involving unsafe types [Unsafe]}} +// expected-warning@+3{{enum 'HasUnsafeThings' has storage involving unsafe types [StrictMemorySafety]}} // expected-note@+2{{add '@unsafe' if this type is also unsafe to use}}{{1-1=@unsafe }} // expected-note@+1{{add '@safe' if this type encapsulates the unsafe storage in a safe interface}}{{1-1=@safe }} enum HasUnsafeThings { @@ -181,7 +181,7 @@ case one(UnsafeSuper) // expected-note{{enum case 'one' involves unsafe type 'Un case two(UnsafeSuper) // expected-note{{enum case 'two' involves unsafe type 'UnsafeSuper'}} } -// expected-warning@+3{{class 'ClassWithUnsafeStorage' has storage involving unsafe types [Unsafe]}} +// expected-warning@+3{{class 'ClassWithUnsafeStorage' has storage involving unsafe types [StrictMemorySafety]}} // expected-note@+2{{add '@unsafe' if this type is also unsafe to use}}{{1-1=@unsafe }} // expected-note@+1{{add '@safe' if this type encapsulates the unsafe storage in a safe interface}}{{1-1=@safe }} class ClassWithUnsafeStorage { diff --git a/userdocs/diagnostic_groups/DeprecatedDeclaration.md b/userdocs/diagnostic_groups/deprecated-declaration.md similarity index 100% rename from userdocs/diagnostic_groups/DeprecatedDeclaration.md rename to userdocs/diagnostic_groups/deprecated-declaration.md diff --git a/userdocs/diagnostic_groups/ExistentialAny.md b/userdocs/diagnostic_groups/existential-any.md similarity index 100% rename from userdocs/diagnostic_groups/ExistentialAny.md rename to userdocs/diagnostic_groups/existential-any.md diff --git a/userdocs/diagnostic_groups/PreconcurrencyImport.md b/userdocs/diagnostic_groups/preconcurrency-import.md similarity index 100% rename from userdocs/diagnostic_groups/PreconcurrencyImport.md rename to userdocs/diagnostic_groups/preconcurrency-import.md diff --git a/userdocs/diagnostic_groups/StrictLanguageFeatures.md b/userdocs/diagnostic_groups/strict-language-features.md similarity index 100% rename from userdocs/diagnostic_groups/StrictLanguageFeatures.md rename to userdocs/diagnostic_groups/strict-language-features.md diff --git a/userdocs/diagnostic_groups/UnknownWarningGroup.md b/userdocs/diagnostic_groups/unknown-warning-group.md similarity index 100% rename from userdocs/diagnostic_groups/UnknownWarningGroup.md rename to userdocs/diagnostic_groups/unknown-warning-group.md diff --git a/userdocs/diagnostic_groups/Unsafe.md b/userdocs/diagnostic_groups/unsafe.md similarity index 100% rename from userdocs/diagnostic_groups/Unsafe.md rename to userdocs/diagnostic_groups/unsafe.md