Make sure we consume a generic arg when checking mistyped turbofish #124930
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When recovering un-turbofish-ed args in expr position (e.g.
let x = a<T, U>();
incheck_mistyped_turbofish_with_multiple_type_params
, we usedparse_seq_to_before_end
to parse the fake generic args; however, it usedparse_generic_arg
which optionally parses a generic arg. If it doesn't end up parsing an arg, it returnsOk(None)
and consumes no tokens. If we don't find a delimiter after this (,
), we try parsing another element. In this case, we just infinitely loop looking for a subsequent element.We can fix this by making sure that we either parse a generic arg or error in
parse_seq_to_before_end
's callback.Fixes #124897