Skip to content

Region-based isolation diagnostic should mention that captured value is non-Sendable #85444

@AnthonyLatsis

Description

@AnthonyLatsis

Description

No response

Reproduction

class C {
    func foo() {
        Task {
            await self.zoo()
        }
    }

    func zoo() async {}
}
 114 |         Task {
     |         `- error: passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure [regionbasedisolation_typed_tns_passed_sending_closure]
 115 |             await self.zoo()
     |                        `- note: closure captures 'self' which is accessible to code in the current task [regionbasedisolation_typed_tns_passed_to_sending_closure_helper_have_value_task_isolated]
 116 |         }

Expected behavior

This note is missing a hint for how to approach the problem. In other words, it does not mention what is preventing self from being safely captured — that C is not Sendable.

Environment

Swift version 6.3-dev (25bcd44)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    SILcompilerThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresdiagnostics QoIBug: Diagnostics Quality of Implementationswift 6.3

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions