@@ -71,23 +71,20 @@ import Test
71
71
import CoreFoundation
72
72
import CxxStdlib
73
73
74
- // expected-warning@+3{{global function 'useUnsafeParam' has an interface that involves unsafe types}}
75
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
76
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{{1-1=@safe }}
77
- func useUnsafeParam( x: Unannotated ) { // expected-note{{reference to unsafe struct 'Unannotated'}}
74
+ func useUnsafeParam( x: Unannotated ) {
75
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
76
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
78
77
}
79
78
80
- // expected-warning@+4{{global function 'useUnsafeParam2' has an interface that involves unsafe types}}
81
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
82
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{{1-1=@safe }}
83
79
@available ( SwiftStdlib 5 . 8 , * )
84
- func useUnsafeParam2( x: UnsafeReference ) { // expected-note{{reference to unsafe class 'UnsafeReference'}}
80
+ func useUnsafeParam2( x: UnsafeReference ) {
81
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
82
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
85
83
}
86
84
87
- // expected-warning@+3{{global function 'useUnsafeParam3' has an interface that involves unsafe types}}
88
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
89
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{{1-1=@safe }}
90
- func useUnsafeParam3( x: UnknownEscapabilityAggregate ) { // expected-note{{reference to unsafe struct 'UnknownEscapabilityAggregate'}}
85
+ func useUnsafeParam3( x: UnknownEscapabilityAggregate ) {
86
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
87
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
91
88
}
92
89
93
90
func useSafeParams( x: Owner , y: View , z: SafeEscapableAggregate , c: MyContainer ) {
@@ -101,10 +98,9 @@ func useCfType(x: CFArray) {
101
98
func useString( x: std . string ) {
102
99
}
103
100
104
- // expected-warning@+3{{global function 'useVecOfPtr' has an interface}}
105
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
106
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
107
- func useVecOfPtr( x: VecOfPtr ) { // expected-note{{reference to unsafe type alias 'VecOfPtr'}}
101
+ func useVecOfPtr( x: VecOfPtr ) {
102
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
103
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
108
104
}
109
105
110
106
func useVecOfInt( x: VecOfInt ) {
@@ -113,22 +109,19 @@ func useVecOfInt(x: VecOfInt) {
113
109
func useSafeTuple( x: SafeTuple ) {
114
110
}
115
111
116
- // expected-warning@+3{{global function 'useUnsafeTuple' has an interface that involves unsafe types}}
117
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
118
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
119
- func useUnsafeTuple( x: UnsafeTuple ) { // expected-note{{reference to unsafe type alias 'UnsafeTuple'}}
112
+ func useUnsafeTuple( x: UnsafeTuple ) {
113
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
114
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
120
115
}
121
116
122
- // expected-warning@+3{{global function 'useCppSpan' has an interface that involves unsafe types}}
123
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
124
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
125
- func useCppSpan( x: SpanOfInt ) { // expected-note{{reference to unsafe type alias 'SpanOfInt'}}
117
+ func useCppSpan( x: SpanOfInt ) {
118
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
119
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
126
120
}
127
121
128
- // expected-warning@+3{{global function 'useCppSpan2' has an interface that involves unsafe types}}
129
- // expected-note@+2{{add '@unsafe' to indicate that this declaration is unsafe to use}}{{1-1=@unsafe }}
130
- // expected-note@+1{{add '@safe' to indicate that this declaration is memory-safe to use}}{1-1=@safe }}
131
- func useCppSpan2( x: SpanOfIntAlias ) { // expected-note{{reference to unsafe type alias 'SpanOfIntAlias'}}
122
+ func useCppSpan2( x: SpanOfIntAlias ) {
123
+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
124
+ _ = x // expected-note{{reference to parameter 'x' involves unsafe type}}
132
125
}
133
126
134
127
func useSafeLifetimeAnnotated( v: View ) {
0 commit comments