Skip to content

Commit

Permalink
Auto merge of rust-lang#22767 - pnkfelix:issue-22265, r=nikomatsakis
Browse files Browse the repository at this point in the history
Avoid `cat_expr Erred` notes when already in error state.

Also, to ensure we do not let the dropck get skipped, ICE if `cat_expr` errors when *not* in error state.

This is not known to be a breaking change (i.e. I do not know of a current case that causes the new ICE to be exercised).

Fix rust-lang#22265
  • Loading branch information
bors committed Feb 25, 2015
2 parents 4db0b32 + 92bc3ea commit 610d169
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/librustc_typeck/check/regionck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,12 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
expr.span);
}
Err(..) => {
rcx.fcx.tcx().sess.span_note(expr.span,
"cat_expr_unadjusted Errd during dtor check");
let tcx = rcx.fcx.tcx();
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");
}
}
}
}
Expand All @@ -571,8 +575,12 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
check_safety_of_rvalue_destructor_if_necessary(rcx, head_cmt, expr.span);
}
Err(..) => {
rcx.fcx.tcx().sess.span_note(expr.span,
"cat_expr Errd during dtor check");
let tcx = rcx.fcx.tcx();
if tcx.sess.has_errors() {
// cannot run dropck; okay b/c in error state anyway.
} else {
tcx.sess.span_bug(expr.span, "cat_expr Errd");
}
}
}

Expand Down

0 comments on commit 610d169

Please sign in to comment.