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() {