mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 15:33:53 +00:00
Auto merge of #22767 - pnkfelix:issue-22265, r=nikomatsakis
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 #22265
This commit is contained in:
commit
610d1695d1
@ -554,8 +554,12 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
|
|||||||
expr.span);
|
expr.span);
|
||||||
}
|
}
|
||||||
Err(..) => {
|
Err(..) => {
|
||||||
rcx.fcx.tcx().sess.span_note(expr.span,
|
let tcx = rcx.fcx.tcx();
|
||||||
"cat_expr_unadjusted Errd during dtor check");
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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);
|
check_safety_of_rvalue_destructor_if_necessary(rcx, head_cmt, expr.span);
|
||||||
}
|
}
|
||||||
Err(..) => {
|
Err(..) => {
|
||||||
rcx.fcx.tcx().sess.span_note(expr.span,
|
let tcx = rcx.fcx.tcx();
|
||||||
"cat_expr Errd during dtor check");
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user