Return correct values
This commit is contained in:
parent
0e76b34aa7
commit
f0de8e82b8
1 changed files with 7 additions and 5 deletions
|
@ -645,15 +645,17 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
|
||||||
// an error must be reported.
|
// an error must be reported.
|
||||||
let reported_err = tcx.sess.track_errors(|| {
|
let reported_err = tcx.sess.track_errors(|| {
|
||||||
err.report_as_error(ecx.tcx,
|
err.report_as_error(ecx.tcx,
|
||||||
"could not evaluate static initializer");
|
"could not evaluate static initializer")
|
||||||
});
|
});
|
||||||
match reported_err {
|
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: {:#?}",
|
&format!("static eval failure did not emit an error: {:#?}",
|
||||||
v)),
|
v));
|
||||||
Err(err) => err,
|
v
|
||||||
|
},
|
||||||
|
Err(ErrorReported) => ErrorHandled::Reported,
|
||||||
}
|
}
|
||||||
reported_err
|
|
||||||
} else if def_id.is_local() {
|
} else if def_id.is_local() {
|
||||||
// constant defined in this crate, we can figure out a lint level!
|
// constant defined in this crate, we can figure out a lint level!
|
||||||
match tcx.describe_def(def_id) {
|
match tcx.describe_def(def_id) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue