Recover missing turbofish for lifetime arguments in expression position - #162749
raushan728 wants to merge 2 commits into
Conversation
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
I need to do a more in-depth review, as I have some mild concerns about increasing the size of the parser, but the results look reasonable so far. I'll look at this again later this week if the assigned reviewer doesn't manage to get the time before then.
|
Reminder, once the PR becomes ready for a review, use |
acf53ca to
ce2a12a
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
ce2a12a to
2e5a236
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
r? @estebank since you already take review :) |
turbofish for lifetime arguments in expression position
2e5a236 to
2b3bcf9
Compare
This comment has been minimized.
This comment has been minimized.
2b3bcf9 to
6836140
Compare
This comment has been minimized.
This comment has been minimized.
6836140 to
976f9ba
Compare
This comment has been minimized.
This comment has been minimized.
976f9ba to
57484e5
Compare
There was a problem hiding this comment.
Funny story this idea actually came to me while I was half asleep last night 😄. Your comment about parser size kept nagging at me and it hit me that we didn't need to touch eat_label/parse_expr_labeled or add any new parser fields at all we could intercept the missing turbofish with a simple lookahead right where < is already being parsed as a binary operator before it ever falls into label parsing.
@estebank should be a much smaller ask for review now
57484e5 to
2a84483
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Fixes #162656.
rustc already suggests
::<>when a type/const generic argument is missing its turbofish (foo<Bar>()), but not for lifetime arguments -Struct<'a> { .. }previously misfired through label/char-literal recovery, producing a confusing cascade of unrelated errors instead of one actionable turbofish suggestion.cc @estebank