-
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
Hide type errors likely caused by incorrect struct literal #60118
Conversation
When encountering a possible struct literal that is actually interpreted as a block because it could be a value `foo { bar }` or `foo { bar: baz }`, we now collect information on both `bar`'s span and the block's span. If we encounter a type error on `bar`, we skip it.
edf78f7
to
0691e58
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Success: Queued 392a7be89b77c187cb74e1b6f29d6b81d9540093 with parent 8aaae42, comparison URL. |
I wouldn't do this personally, too many hacks for covering one specific case. cc @rust-lang/compiler |
This comment has been minimized.
This comment has been minimized.
I think I agree with @petrochenkov that this PR is going to impose a difficult maintenance burden -- the reason is that it seems quite "non-local" in the way that it communicates information (also, adding shared mutable state will generally interfere with incremental and parallelization efforts, even if it is using a lock). However, I am generally in favor of us trying to get more sophisticated in the way that we suppress downstream errors -- but I think we should be careful in how we engineer it. |
We have a number of generic tools for doing that - |
Right. |
Perhaps we need a generic |
When encountering a parse error that could be a struct literal, but that we can't be certain, keep the found span around until we find a type error that confirms it, provide the appropriate suggestion to surround with braces and hide every type error and non-found ident error coming from within the likely struct literal's span.
r? @petrochenkov
Follow up to #59981