Skip to content

Conversation

@gottesmm
Copy link
Contributor

This is important to ensure that we require the base of src if the src is non-Sendable (e.x.: a non-Sendable box).

rdar://163322459
#85107

…value being stored is Sendable

This is important to ensure that we require the base of src if the src is
non-Sendable (e.x.: a non-Sendable box).

rdar://163322459
swiftlang#85107
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for the other cases mentioned in the report, for completeness? <T: AnyObject & Sendable>, and an AnyObject existential

// expected-ni-ns-note @-2 {{sending task-isolated 'x' to @concurrent global function 'useValueAsyncConcurrent' risks causing data races between @concurrent and task-isolated uses}}
}

enum RequireSrcWhenStoringEvenWhenSendable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any chance the solution here can be extended to address this case as well:

// https://github.com/swiftlang/swift/issues/82827
@MainActor
func test_82827() {
    var s = 1
    Task {
        for _ in 0..<100 {
            s += 1
        }
    }
    Task.detached { _ = s } // not diagnosed
}

or is that a separate problem?

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.

3 participants