-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Weird diagnostic when typing a .
instead of a ,
#44339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes I agree, I will take a look at the code. |
I could have sworn that there was a dupe for this ticket.
We could go the extra mile and 1) try to be eager in what is accepted by attempting to parse the idents regardless and when finding errors skipping until the next thing that looks like an ident or |
Another example, from #33188 (closed as a duplicate of this issue): Compiling the following:
produces:
|
Hi, I'm working on solving this now |
@thombles, great! You probably want to modify |
I've replaced parse_seq_to_before_end with my own function. It turns out it is only responsible for the first emit(), so my HashSet isn't doing any good. Not sure where the second one is coming from yet but I'll track it down. |
I see. Let me know if you need any help tracking it down. |
I have a new solution coming together. I think it will need to be fairly conservative. The basic problem is that The general improvement is to make
So I think we can handle two cases:
I'm working towards a new pull request but I thought I'd write this up here in case anyone has any thoughts! |
Improve diagnostics when list of tokens has incorrect separators Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations: ``` struct S(pub () ()); // omitted separator use std::{foo. bar}; // used a similar but wrong separator ``` Fixes #44339 r? @petrochenkov
Compiling
yields
The first error makes sense, but the second one seems pretty bogus to me.
The text was updated successfully, but these errors were encountered: