@@ -83,6 +83,18 @@ ArrayTraps.test("bounds_with_downcast")
83
83
_ = da [ 2 ]
84
84
}
85
85
86
+ func hasBackdeployedConcurrencyRuntime( ) -> Bool {
87
+ // If the stdlib we've loaded predates Swift 5.5, then we're running on a back
88
+ // deployed concurrency runtime, which has the side effect of disabling
89
+ // regular runtime exclusivity checks.
90
+ //
91
+ // This makes the two tests below fall back to older, higher-level exclusivity
92
+ // checks in the stdlib, which will still trap, but with a different message.
93
+ if #available( SwiftStdlib 5 . 5 , * ) { return false } // recent enough production stdlib
94
+ if #available( SwiftStdlib 9999 , * ) { return false } // dev stdlib
95
+ return true
96
+ }
97
+
86
98
var ArraySemanticOptzns = TestSuite ( " ArraySemanticOptzns " + testSuiteSuffix)
87
99
88
100
class BaseClass {
@@ -131,8 +143,11 @@ ArraySemanticOptzns.test("inout_rule_violated_isNativeBuffer")
131
143
. skip ( . custom(
132
144
{ _isFastAssertConfiguration ( ) } ,
133
145
reason: " this trap is not guaranteed to happen in -Ounchecked " ) )
134
- . crashOutputMatches ( _isDebugAssertConfiguration ( ) ?
135
- " Fatal access conflict detected. " : " " )
146
+ . crashOutputMatches (
147
+ !_isDebugAssertConfiguration( ) ? " "
148
+ : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
149
+ : " Fatal access conflict detected. "
150
+ )
136
151
. code {
137
152
let v = ViolateInoutSafetySwitchToObjcBuffer ( )
138
153
expectCrashLater ( )
@@ -174,8 +189,11 @@ ArraySemanticOptzns.test("inout_rule_violated_needsElementTypeCheck")
174
189
. skip ( . custom(
175
190
{ _isFastAssertConfiguration ( ) } ,
176
191
reason: " this trap is not guaranteed to happen in -Ounchecked " ) )
177
- . crashOutputMatches ( _isDebugAssertConfiguration ( ) ?
178
- " Fatal access conflict detected. " : " " )
192
+ . crashOutputMatches (
193
+ !_isDebugAssertConfiguration( ) ? " "
194
+ : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
195
+ : " Fatal access conflict detected. "
196
+ )
179
197
. code {
180
198
let v = ViolateInoutSafetyNeedElementTypeCheck ( )
181
199
expectCrashLater ( )
0 commit comments