You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[rbi] When finding closure uses in an immediately invoked closure, distinguish in between captures and parameters.
Otherwise, when one diagnoses code like the following:
```
Task {
{
use($0)
}(x)
}
```
One gets that $0 was captured instead of x. Unfortunately, since function
parameters do not have locations associated with them, we do not mark x
itself... instead, we mark the closure... which is unfortunate.
Task{ // expected-warning {{passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure}}
528
+
{ // expected-note {{closure captures 'x' which is accessible to code in the current task}}
529
+
print($0)
530
+
}(x)
531
+
}
532
+
527
533
takeClosure{ // expected-warning {{passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure}}
528
534
print(x) // expected-note {{closure captures 'x' which is accessible to code in the current task}}
0 commit comments