Skip to content

Commit

Permalink
transform broken MIR warnings to hard ICEs
Browse files Browse the repository at this point in the history
We ought to do that sometime, and this PR fixes all broken MIR errors I
could find.
  • Loading branch information
arielb1 committed Mar 1, 2017
1 parent 2ecbc22 commit 4aede75
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/librustc_mir/transform/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
})
Expand Down

0 comments on commit 4aede75

Please sign in to comment.