Skip to content

[6.2][Concurrency] Task.immediate returning Never error must not have thro… #82373

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

ktoso
Copy link
Contributor

@ktoso ktoso commented Jun 20, 2025

Description: The error = Never overload of Task.immediate accidentally had a throws operation function which is incorrect.
Scope/Impact: We'd allow throwing in an immediate task where the error would not be captured and could lead to a runtime crash.
Risk: Low, the functions are AEIC and therefore no ABI impact. Existing code which did throw in such code would be incorrect and at risk of crashing.
Testing: Added test for this case
Reviewed by: @xedin

Original PR: #82372
Radar: rdar://153855920

@ktoso ktoso requested a review from a team as a code owner June 20, 2025 01:20
@ktoso
Copy link
Contributor Author

ktoso commented Jun 20, 2025

@swift-ci please test

@ktoso
Copy link
Contributor Author

ktoso commented Jun 23, 2025

@swift-ci please test

@ktoso
Copy link
Contributor Author

ktoso commented Jun 23, 2025

Small update from review on main

@ktoso ktoso changed the title [Concurrency] Task.immediate returning Never error must not have thro… [6.2][Concurrency] Task.immediate returning Never error must not have thro… Jun 23, 2025
@ktoso
Copy link
Contributor Author

ktoso commented Jun 24, 2025

What the diff actually is in the generated code:

Screenshot 2025-06-24 at 13 08 02
Screenshot 2025-06-24 at 13 08 09

Notice that that's the Never error functions, so they should not be throwing -- which is the fix this patch does.

@DougGregor DougGregor merged commit ef622dd into swiftlang:release/6.2 Jun 24, 2025
5 checks passed
@ktoso ktoso deleted the pick-wip-NeverErrorTaskShouldNotThrowInOperation branch June 25, 2025 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants