Closed veera-sivarajan closed 1 week ago
r? @compiler-errors
rustbot has assigned @compiler-errors. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r?
to explicitly pick a reviewer
@rustbot ready
@rustbot author
r=me after changing the diagnostic one last time, thanks for dealing with the back-and-forth
Thanks @bors r+ rollup
Fixes #124495
Previously,
break
insidegen
blocks and functions were incorrectly identified to be enclosed by a closure.This PR fixes it by displaying an appropriate error message for async blocks, async closures, async functions, gen blocks, gen closures, gen functions, async gen blocks, async gen closures and async gen functions.
Note: gen closure and async gen closure are not supported by the compiler yet but I have added an error message here assuming that they might be implemented in the future.
~~Also, fixes grammar in a few places by replacing
inside of a $coroutine
withinside a $coroutine
.~~