Return correct values

This commit is contained in:
Yuki OKUSHI 2019-03-25 03:19:48 +09:00
parent 0e76b34aa7
commit f0de8e82b8

View File

@ -645,15 +645,17 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
// an error must be reported.
let reported_err = tcx.sess.track_errors(|| {
err.report_as_error(ecx.tcx,
"could not evaluate static initializer");
"could not evaluate static initializer")
});
match reported_err {
Ok(v) => tcx.sess.delay_span_bug(err.span,
Ok(v) => {
tcx.sess.delay_span_bug(err.span,
&format!("static eval failure did not emit an error: {:#?}",
v)),
Err(err) => err,
v));
v
},
Err(ErrorReported) => ErrorHandled::Reported,
}
reported_err
} else if def_id.is_local() {
// constant defined in this crate, we can figure out a lint level!
match tcx.describe_def(def_id) {