WIP: remove report_as_error

This commit is contained in:
Yuki OKUSHI 2019-03-24 14:45:27 +09:00
parent ee0e1b7615
commit 0e76b34aa7

View File

@ -641,19 +641,17 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
let err = error_to_const_error(&ecx, error);
// errors in statics are always emitted as fatal errors
if tcx.is_static(def_id).is_some() {
let reported_err = err.report_as_error(ecx.tcx,
"could not evaluate static initializer");
// Ensure that if the above error was either `TooGeneric` or `Reported`
// an error must be reported.
let tracked_err = tcx.sess.track_errors(|| {
let reported_err = tcx.sess.track_errors(|| {
err.report_as_error(ecx.tcx,
"could not evaluate static initializer");
});
match tracked_err {
Ok(reported_err) => tcx.sess.delay_span_bug(err.span,
match reported_err {
Ok(v) => tcx.sess.delay_span_bug(err.span,
&format!("static eval failure did not emit an error: {:#?}",
reported_err)),
Err(_) => (),
v)),
Err(err) => err,
}
reported_err
} else if def_id.is_local() {