You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// expected-warning@+1 {{global function 'rethrowing' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}{{1-1=@unsafe }}
34
+
// expected-warning@+3 {{global function 'rethrowing' has an interface that involves unsafe types}}
35
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
36
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
33
37
func rethrowing(body:(UnsafeType)throws->Void)rethrows{} // expected-note{{reference to unsafe struct 'UnsafeType'}}
34
38
35
39
classHasStatics{
36
-
// expected-warning@+1{{static method 'f' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe }}{{3-3=@unsafe }}
40
+
// expected-warning@+3{{static method 'f' has an interface that involves unsafe types}}
41
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{3-3=@unsafe }}
42
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{3-3=@safe }}
37
43
staticinternalfunc f(_:UnsafeType){} // expected-note{{reference to unsafe struct 'UnsafeType'}}
Copy file name to clipboardExpand all lines: test/Unsafe/unsafe-suppression.swift
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,11 @@ func iAmUnsafe() { }
9
9
@unsafe
10
10
structUnsafeType{}
11
11
12
-
// expected-note@+1{{reference to unsafe struct 'UnsafeType'}}
12
+
// expected-note@+3{{reference to unsafe struct 'UnsafeType'}}
13
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
14
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
13
15
func iAmImpliedUnsafe()->UnsafeType?{nil}
14
-
// expected-warning@-1{{global function 'iAmImpliedUnsafe' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}{{1-1=@unsafe }}
16
+
// expected-warning@-1{{global function 'iAmImpliedUnsafe' has an interface that involves unsafe types}}
Copy file name to clipboardExpand all lines: test/Unsafe/unsafe.swift
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,9 @@ class UnsafeSub: UnsafeSuper { }
130
130
@unsafevarunsafeVar:Int=0
131
131
132
132
133
-
// expected-warning@+1{{global function 'testMe' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}{{1-1=@unsafe }}
133
+
// expected-warning@+3{{global function 'testMe' has an interface that involves unsafe types}}
134
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
135
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
134
136
func testMe(
135
137
_ pointer:PointerType, // expected-note{{reference to unsafe struct 'PointerType'}}
136
138
_ unsafeSuper:UnsafeSuper // expected-note{{reference to unsafe class 'UnsafeSuper'}}
Copy file name to clipboardExpand all lines: test/Unsafe/unsafe_imports.swift
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,9 @@
9
9
import unsafe_decls
10
10
import unsafe_swift_decls
11
11
12
-
// expected-warning@+1{{global function 'testUnsafe' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}{{1-1=@unsafe }}
12
+
// expected-warning@+3{{global function 'testUnsafe' has an interface that involves unsafe types}}
13
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
14
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
13
15
func testUnsafe(_ ut:UnsafeType){ // expected-note{{reference to unsafe struct 'UnsafeType'}}
14
16
// expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{3-3=unsafe }}
15
17
unsafe_c_function() // expected-note{{reference to unsafe global function 'unsafe_c_function()'}}
// Reference a typealias that isn't itself @unsafe, but refers to an unsafe
24
26
// type.
25
27
26
-
// expected-warning@+1{{global function 'testUnsafeThroughAlias' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}
28
+
// expected-warning@+3{{global function 'testUnsafeThroughAlias' has an interface that involves unsafe types}}
29
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
30
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
27
31
func testUnsafeThroughAlias(_ ut:UnsafeTypeAlias){ // expected-note{{reference to type alias 'UnsafeTypeAlias' involves unsafe type 'UnsafeTypeAlias' (aka 'PointerType')}}
Copy file name to clipboardExpand all lines: test/Unsafe/unsafe_stdlib.swift
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@
6
6
// REQUIRES: swift_feature_AllowUnsafeAttribute
7
7
// REQUIRES: swift_feature_WarnUnsafe
8
8
9
-
// expected-warning@+1{{global function 'test' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}{{1-1=@unsafe }}
9
+
// expected-warning@+3{{global function 'test' has an interface that involves unsafe types}}
10
+
// expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
11
+
// expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
10
12
func test(
11
13
x:OpaquePointer, // expected-note{{reference to unsafe struct 'OpaquePointer'}}
12
14
other:UnsafeMutablePointer<Int> // expected-note{{reference to unsafe generic struct 'UnsafeMutablePointer'}}
0 commit comments