-
Notifications
You must be signed in to change notification settings - Fork 124
Fix crash when running swift test for swift-build #725
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
Conversation
@swift-ci test |
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.
Lgtm!
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.
Ahh, nice catch. I think it's a compiler bug that withExtendedLifetime
can contain async code despite its closure parameter not being annotated async
?
Do we have a bug on the compiler to diagnose this as a compile-time error instead?
@swift-ci test |
I mis-remembered, I was thinking of @_alwaysEmitIntoClient
public func withExtendedLifetime<T: ~Copyable, E: Error, Result: ~Copyable>(
_ x: borrowing T,
_ body: (borrowing T) async throws(E) -> Result
) async throws(E) -> Result {
defer { withExtendedLifetime(x) { } }
return try await body(x)
} (making this crash even more puzzling, since this patch is effectively just inlining the code) |
Yeah it's a bit puzzling but it seems something about this pattern was upsetting 🤔 |
Fix crash when running swift test for swift-build.
Was consistently able to cause the following crash prior to this change:
Thread 1 Crashed: 0 libswift_Concurrency.dylib 0x286d730b4 swift_task_alloc + 92 1 SwiftBuildPackageTests 0x1136b9c78 withExtendedLifetime<A, B, C>(_:_:) + 256 (Misc+Async.swift:124) 2 SwiftBuildPackageTests 0x113715c39 static NSTask.getOutput(url:arguments:currentDirectoryURL:environment:interruptible:) + 1 (Process.swift:86)