-
Notifications
You must be signed in to change notification settings - Fork 102
Enable Library Evolution in package builds for public library targets #951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Library Evolution in package builds for public library targets #951
Conversation
Fixes rdar://144655439
@swift-ci please test |
@@ -199,7 +199,7 @@ public struct Configuration: Sendable { | |||
/// property is pre-configured. Otherwise, the default value of this property | |||
/// records an issue indicating that it has not been configured. | |||
@_spi(Experimental) | |||
public var exitTestHandler: ExitTest.Handler = { _ in | |||
public var exitTestHandler: ExitTest.Handler = { exitTest in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I enabled Library Evolution, I got a compiler crash when building with a main
snapshot toolchain which has asserts enabled:
Begin Error in Function: '$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_'
Found outside of lifetime use?!
Value: %2 = load_borrow %1 : $*__ExitTest // users: %8, %4, %3
Consuming User: end_borrow %2 : $__ExitTest // id: %4
Non Consuming User: debug_value %2 : $__ExitTest, let, name "_0", argno 1 // id: %8
Block: bb0
End Error in Function: '$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_'
Found ownership error?!
1. Apple Swift version 6.2-dev (LLVM 5805166b4c9eb06, Swift 57234f8034befac)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Non-Diagnostic Mandatory Optimizations, Serialization, Rest of Onone } on SIL for Testing)
4. While running pass #679 SILFunctionTransform "OwnershipModelEliminator" on SILFunction "@$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_".
for expression at [/Users/stuart/Work/swift-testing/Sources/Testing/Running/Configuration.swift:221:50 - line:223:3] RangeText="{ (_: borrowing ExitTest) throws -> ExitTestArtifacts in
throw SystemError(description: "Exit test support has not been implemented by the current testing infrastructure.")
"
5. Found verification error when verifying before lowering ownership. Please re-run with -sil-verify-all to identify the actual pass that introduced the verification error.
6. While verifying SIL function "@$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_".
for expression at [/Users/stuart/Work/swift-testing/Sources/Testing/Running/Configuration.swift:221:50 - line:223:3] RangeText="{ (_: borrowing ExitTest) throws -> ExitTestArtifacts in
throw SystemError(description: "Exit test support has not been implemented by the current testing infrastructure.")
"
The closure parameter is of type borrowing ExitTest
, and as a workaround I found simply giving it a name instead of the wildcard _
resolves the crash. I can file an issue to track that separately tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's bizarre. Okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think this might be the same issue as the one you just had to work around? @jckarter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a different issue than swiftlang/swift#79304
…oss-import overlay
@swift-ci please test |
@swift-ci please test |
@swift-ci please test macOS |
…ry target (#1082) This enables Library Evolution (LE) for the `_TestDiscovery` target in Swift package-based builds. The CMake-based build is already configured to enable LE for this target, so this is just matching behavior. (Note that we already enable LE for several other targets which vend public API as of #951.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
This modifies
Package.swift
to enable Library Evolution for builds of the package.Motivation:
I recently landed a change (#931) which passed our project-level CI but later failed in Swift CI. The difference ended up being due to the latter building with Library Evolution (LE) enabled, whereas our project-level CI builds via SwiftPM and does not enable LE. The change was reverted (#950) but this revealed a gap in our testing strategy. We should always build these targets with LE enabled.
Checklist:
Fixes rdar://144655439