From b40c838ca687108c113aeef42d2c647a0312b404 Mon Sep 17 00:00:00 2001 From: Raj Date: Wed, 12 Nov 2025 17:52:28 -0800 Subject: [PATCH 1/2] Fix assertionFailure() not respecting -assert-config Release at -Onone --- stdlib/public/core/Assert.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stdlib/public/core/Assert.swift b/stdlib/public/core/Assert.swift index 325f1d1dfdc6b..e25d84a553b7a 100644 --- a/stdlib/public/core/Assert.swift +++ b/stdlib/public/core/Assert.swift @@ -163,8 +163,7 @@ public func precondition( /// where `assertionFailure(_:file:line:)` is called. /// - line: The line number to print along with `message`. The default is the /// line number where `assertionFailure(_:file:line:)` is called. -@inlinable -@inline(__always) +@_transparent #if $Embedded @_disfavoredOverload #endif @@ -182,8 +181,7 @@ public func assertionFailure( } #if $Embedded -@inlinable -@inline(__always) +@_transparent public func assertionFailure( _ message: @autoclosure () -> StaticString = StaticString(), file: StaticString = #file, line: UInt = #line From fcc1c9609e9f532b056238c65cd8d9a07db58eb8 Mon Sep 17 00:00:00 2001 From: Raj Date: Thu, 13 Nov 2025 14:57:24 -0800 Subject: [PATCH 2/2] update test to expect the new, changed behavior --- validation-test/stdlib/AssertDiagnosticsSIL.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/validation-test/stdlib/AssertDiagnosticsSIL.swift b/validation-test/stdlib/AssertDiagnosticsSIL.swift index 72a74440ab59b..428337bcb245c 100644 --- a/validation-test/stdlib/AssertDiagnosticsSIL.swift +++ b/validation-test/stdlib/AssertDiagnosticsSIL.swift @@ -1,7 +1,10 @@ // RUN: %target-swift-frontend %s -emit-sil -verify -func assertionFailure_isNotNoreturn() -> Int { - _ = 0 // Don't implicitly return the assertionFailure call. +// assertionFailure() is now @_transparent (previously @inlinable), so the +// compiler can see that it never returns, eliminating the "missing return" error. +func assertionFailure_isNoreturn() -> Int { + _ = 0 assertionFailure("") -} // expected-error {{missing return in global function expected to return 'Int'}} + // No error expected - assertionFailure() is recognized as Never-returning +}