Skip to content

Commit 309dbe1

Browse files
committed
[embedded] Make fatalError() in embedded Swift only print in non-production builds (-Onone or -assert-config Debug)
1 parent 1bf38aa commit 309dbe1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stdlib/public/core/Assert.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ public func fatalError(
278278
_ message: @autoclosure () -> StaticString = StaticString(),
279279
file: StaticString = #file, line: UInt = #line
280280
) -> Never {
281-
_assertionFailure("Fatal error", message(), file: file, line: line,
282-
flags: _fatalErrorFlags())
281+
if _isDebugAssertConfiguration() {
282+
_assertionFailure("Fatal error", message(), file: file, line: line,
283+
flags: _fatalErrorFlags())
284+
}
285+
_conditionallyUnreachable()
283286
}
284287
#endif
285288

0 commit comments

Comments
 (0)