@@ -83,6 +83,18 @@ ArrayTraps.test("bounds_with_downcast")
8383 _ = da [ 2 ]
8484}
8585
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+
8698var ArraySemanticOptzns = TestSuite ( " ArraySemanticOptzns " + testSuiteSuffix)
8799
88100class BaseClass {
@@ -131,8 +143,11 @@ ArraySemanticOptzns.test("inout_rule_violated_isNativeBuffer")
131143 . skip ( . custom(
132144 { _isFastAssertConfiguration ( ) } ,
133145 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+ )
136151 . code {
137152 let v = ViolateInoutSafetySwitchToObjcBuffer ( )
138153 expectCrashLater ( )
@@ -174,8 +189,11 @@ ArraySemanticOptzns.test("inout_rule_violated_needsElementTypeCheck")
174189 . skip ( . custom(
175190 { _isFastAssertConfiguration ( ) } ,
176191 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+ )
179197 . code {
180198 let v = ViolateInoutSafetyNeedElementTypeCheck ( )
181199 expectCrashLater ( )
0 commit comments