Remove support for prefix yield by eholk · Pull Request #148313 · rust-lang/rust (original) (raw)
Could we keep the parse, creating an error expression kind with an appropriate suggestion for the postfix?
Ideally, if maintenance cost wasn't a thing, we'd keep the yield kind too, for later more complex diagnostics, but at the very least we should be able to parse yield foo to tell people to use foo.yield instead (like we already do for await foo).
We're diverging from other language's syntax. Without an explicit check, we'd end up with something like:
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `foo`
--> src/lib.rs:2:9
|
2 | yield foo;
| ^^^ expected one of 8 possible tokens
|
help: you might have meant to write a field access
|
2 | yield.foo;
| +