-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[rbi] When translating a Store, make sure to require src even if the value being stored is Sendable #85164
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
[rbi] When translating a Store, make sure to require src even if the value being stored is Sendable #85164
Conversation
|
@swift-ci smoke test |
slavapestov
left a comment
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.
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 { |
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.
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?
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 is a separate problem. I took a quick look and we are at least not assuming that placing the non-Sendable box into the first Task makes it MainActor isolated. I would need to look further to find the fix. But it isn't this.
3f180c6 to
05df552
Compare
|
@swift-ci smoke test |
|
We are emitting an error on this now: |
|
@swift-ci smoke test |
…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
…ard declared vars. rdar://164042741
05df552 to
f0a4571
Compare
|
@swift-ci smoke test |
|
@swift-ci smoke test macOS platform |
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