-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Delay specific span_bug() call until abort_if_errors() #24367
Conversation
An actual typeck error is the cause of many failed compilations but an unrelated bug is being reported instead. It is triggered because a typeck error is presumably not yet identified during compiler execution, which would normally bypass an invariant in the presence of other errors. In this particular situation, we delay the reporting of the bug until abort_if_errors(). Closes rust-lang#23827, closes rust-lang#24356, closes rust-lang#23041, closes rust-lang#22897, closes rust-lang#23966, closes rust-lang#24013, and closes rust-lang#23729
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @pnkfelix |
@@ -544,7 +544,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) { | |||
if tcx.sess.has_errors() { | |||
// cannot run dropck; okay b/c in error state anyway. | |||
} else { | |||
tcx.sess.span_bug(expr.span, "cat_expr_unadjusted Errd"); | |||
tcx.sess.delay_span_bug(expr.span, "cat_expr Errd"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't change the message here; it is still a call to cat_expr_unadjusted
up above, which is info I wanted to capture in the ICE message.
My reasoning behind calling I guess as long as such cases continue to emit an ICE, then its not wrong to make this change. But I wonder if it might be simpler (and more correct) to try to identify an earlier spot in the control flow to add an additional call to Update: Of course there is also the option of doing both; i.e. land this PR now, but also try to fix the ICE itself by finding a new place (or more) to call Update 2: Adding earlier calls to |
@arielb1 points out that inserting a new call to The real problem here, @arielb1 points out, is that the guard on the Update: On further investigation, I am not 100% sure the analysis in this comment is quite right. E.g. I do not yet see how one can have errors registered in the |
Actually, another potential way to go here would be to use the same strategy employed in this PR, except with the refinement that the That is, if we did end up reporting at least one error, then we could just say "okay, lets pretend that was the error that caused (Though I do worry about the potential for circular reasoning here, where a |
If I'm reading your comment right, that's what the code currently does. It should abort before the match *delayed_bug if there are any errors. |
I say remove the |
Done with both your recommendations, but it'd be nicer if these ICEs can be avoided by changing mem_categorization somehow. |
@ebfull after discussion with @arielb1 on IRC, I think we can indeed avoid many of the ICE's, not by changing mem_categorization, but rather by restructuring the type checker to do high-level signature-matching checks (e.g. that trait impls define all necessary items from the trait definitions) before checking any bodies. I have a prototype that does that in development right now. We may indeed still want to put in this PR, but i am not certain of that yet; I, like you, would prefer to get rid of this ICE entirely. (And indeed, the path to get there may still involve changes to mem_categorization; I am not sure yet.) |
@ebfull btw you were correct when you wrote:
that is, my comment was based on a misreading of your code. Update: fixed typo where I mistyped @ebfull 's username. |
I have opened #24422 , which adopts the strategy outlined in an earlier comment. However, it does not address all of the ICE's listed in this ticket. So we may still indeed want to adopt this change. I will look into it. |
@pnkfelix ebfull != ebull :) From: Felix S Klock II [email protected] I have opened #24422#24422 , which adopts the strategy outlined in an earlier comment. [https://avatars3.githubusercontent.com/u/173127?v=3&s=400]#24422 Typeck highlevel before bodies by pnkfelix · Pull Request #24422 · rust-lang/rust · GitHub However, it does not address all of the ICE's listed in this ticket. So we may still indeed want to adopt this change. I will look into it. Reply to this email directly or view it on GitHubhttps://github.com//pull/24367#issuecomment-92979142. |
r? @pnkfelix (fell through the cracks?) |
@huonw well, i was half-hoping to find a way to fix all of the known ICE's without adopting the strategy outlined in this PR. But its probably a better plan to adopt it at this point. |
|
||
fn unconstrained_type() { | ||
[]; | ||
//~^ ERROR cannot determine a type for this expression: unconstrained type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I stopped testing against what you fixed in #24422 as well. |
⌛ Testing commit be11171 with merge 7765aed... |
💔 Test failed - auto-mac-32-opt |
@bors: retry On Sat, Apr 25, 2015 at 6:10 AM, bors [email protected] wrote:
|
💔 Test failed - auto-linux-64-nopt-t |
@bors retry |
An actual typeck error is the cause of many failed compilations but an unrelated bug is being reported instead. It is triggered because a typeck error is presumably not yet identified during compiler execution, which would normally bypass an invariant in the presence of other errors. In this particular situation, we delay the reporting of the bug until abort_if_errors(). Closes #23827, closes #24356, closes #23041, closes #22897, closes #23966, closes #24013, and closes #23729 **There is at least one situation where this bug may still be genuinely triggered (#23437).**
Should this be backported to beta like #24422? |
triage: beta-nominated (I am personally on fence, but it is worth discussing) |
not accepted for beta backport. |
An actual typeck error is the cause of many failed compilations but an
unrelated bug is being reported instead. It is triggered because a typeck
error is presumably not yet identified during compiler execution, which
would normally bypass an invariant in the presence of other errors. In
this particular situation, we delay the reporting of the bug until
abort_if_errors().
Closes #23827, closes #24356, closes #23041, closes #22897, closes #23966,
closes #24013, and closes #23729
There is at least one situation where this bug may still be genuinely
triggered (#23437).