transform broken MIR warnings to hard ICEs

We ought to do that sometime, and this PR fixes all broken MIR errors I
could find.
This commit is contained in:
Ariel Ben-Yehuda 2017-03-01 02:44:01 +02:00
parent 2ecbc22856
commit 4aede75914
1 changed files with 7 additions and 8 deletions

View File

@ -25,22 +25,21 @@ use syntax_pos::{Span, DUMMY_SP};
use rustc_data_structures::indexed_vec::Idx;
fn mirbug(tcx: TyCtxt, span: Span, msg: &str) {
tcx.sess.diagnostic().span_bug(span, msg);
}
macro_rules! span_mirbug {
($context:expr, $elem:expr, $($message:tt)*) => ({
$context.tcx().sess.span_warn(
$context.last_span,
&format!("broken MIR ({:?}): {}", $elem, format!($($message)*))
)
mirbug($context.tcx(), $context.last_span,
&format!("broken MIR ({:?}): {}", $elem, format!($($message)*)))
})
}
macro_rules! span_mirbug_and_err {
($context:expr, $elem:expr, $($message:tt)*) => ({
{
$context.tcx().sess.span_warn(
$context.last_span,
&format!("broken MIR ({:?}): {:?}", $elem, format!($($message)*))
);
span_mirbug!($context, $elem, $($message)*);
$context.error()
}
})