-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Weird type error after syntax error #44579
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
WG-diagnostics
Working group: Diagnostics
Comments
bors
added a commit
that referenced
this issue
Dec 18, 2017
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
bors
added a commit
that referenced
this issue
Dec 21, 2017
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
bors
added a commit
that referenced
this issue
Dec 22, 2017
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
WG-diagnostics
Working group: Diagnostics
Steps to Reproduce
Given this code:
Expected Output
The syntax error is diagnosed
Actual Output
I'm sorry to be so harsh on the diagnostics; but we can be better at showing the user relevant diagnostics. (I remember g++ and having to learn to ignore everything after the first error. And those error outputs were long..)
This bug was reported after a discussion in #rust-beginners after a user was struggling with similar code and they came asking about error no. 2. Not about both errors, but about error no. 2.
The text was updated successfully, but these errors were encountered: