Closed brson closed 8 years ago
I blame the fact that we’re trying to recover from errors too hard. At the very least we should not continue into resolve after parse failures, should we? That will never work out.
This is a result of https://github.com/rust-lang/rust/pull/31555 and/or https://github.com/rust-lang/rust/pull/31065, so the post-parsing error messages are kind of expected, but still mostly harmful.
I think continuing after parse errors can work well, but perhaps we should disable this sort of recovery on stable channels until we are better able to handle it. Another common failure I see is lifetime errors due to random type-checking failures -- I'm not exactly sure what causes those, but I'm sure you all have seen them.
We could recover "opt in" with -Z continue
or something, but I'd like us to all experience the errors better so we can work better on heuristics and improvements...
Although not related to parse errors, I've found a very similar bug related to worse error messages in the case of a resolve failure: https://github.com/rust-lang/rust/issues/31997
We probably want some kind of meta issue here, ultimately -- but my feeling is that we should continue to work towards better support for generating more errors, but we should not jump the gun and inflict these things on the "waiting public" until they are ready.
cc @rust-lang/compiler @rust-lang/tools
I personally like the idea of perhaps a -Z
flag to change the behavior here in terms of not letting this propagate to stable. I'm not a huge fan of using a flag to test our error messages as the likelihood of anyone using it seems very small, however.
I personally like the idea of perhaps a -Z flag to change the behavior here in terms of not letting this propagate to stable.
The main reason I proposed having the more advanced errors enabled by default (not behind a flag) on nightly was to ensure that we actually exercise the code, find ICEs, and so forth...
We discussed in the @rust-lang/core meeting today. General feeling was that we should make surgical changes to try and stop issuing so many follow-on messages, and then revisit later when we think we can do better about being more targeted in these error reports to things we think are likely real problems. We decided having nightly diverge from beta behavior was a bad idea.
Does anyone have a kind of standalone example of this?
I spent a few minutes trying to make one and failed.
Nonetheless it seems clear that the recovery in https://github.com/rust-lang/rust/pull/31555 is at fault. So maybe we can modify the logic there -- but it'd be great to have some kind of test, so that we have some idea when we can turn that recovery back on. I'll try to experiment today. I plan to fix the problems in #31997 first, since I have a smaller testcase there.
For the record, this is the output I see from @brson's test case: https://gist.github.com/nikomatsakis/b5d93abd92fb30487753
In a recent project I had a single typo - failing to close a paren. The error message is below. Remember, there is only one error here, a missing paren. Every single error here is useless. This happens a lot.