-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Bad parse error message for missing alt close brace #2354
Comments
I have often wanted this too, though I imagine it is quite hard to correctly decide which brace is the unclosed one. After all, if you put a |
Maybe duplicate of #643 |
The example in #643 is considerably easier than this one. |
@nikomatsakis: Do you mean it does not cover the same issue? Isn't the underlying problem "we don't know where the missing brace is, until we hit EOF" the same? |
Is the current error. |
Updated code during triage. I get the same error @cmr is seeing now, which is not bad but we could possibly do better if we pointed to, say, the current still-open delimiter. It might not be the unbalanced one, but it's a place to point the user at least. |
(bug triage) Milestone looks right; carry on. |
I'm getting annoyed with this enough to want to fix it. For me, the issue comes up pretty often when I do a merge and accidentally delete a brace, and then it can be quite a while before I see the compile error and I've forgotten what part of the code I edited. It doesn't seem like it would be impossible to keep a stack of open delimiters and refer to their spans in the error message. In any case, I'm going to try to fix this in my next spare moment. |
r? anybody It's more helpful to list the span of each open delimiter seen so far than to print out an error with the span of the last position in the file. Closes #2354
Fix README typo "behaivours" -> "behaviours". Just something I noticed while reading
It looks like the other changes done by rust-lang#2311 to the release docker file were not as harmless as I thought. This change reverts them to fix the release action.
In this code:
foo
is missing the close brace for thealt
, but the resulting parse error message is very unhelpful:It would be much more helpful to report the error at the location where the un-closed brace was (in this case, after the alt in
foo
). I don't know how easy it would be to do with the current parser, though.The text was updated successfully, but these errors were encountered: