Skip to content

Commit 4aede75

Browse files
committed
transform broken MIR warnings to hard ICEs
We ought to do that sometime, and this PR fixes all broken MIR errors I could find.
1 parent 2ecbc22 commit 4aede75

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/librustc_mir/transform/type_check.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,21 @@ use syntax_pos::{Span, DUMMY_SP};
2525

2626
use rustc_data_structures::indexed_vec::Idx;
2727

28+
fn mirbug(tcx: TyCtxt, span: Span, msg: &str) {
29+
tcx.sess.diagnostic().span_bug(span, msg);
30+
}
31+
2832
macro_rules! span_mirbug {
2933
($context:expr, $elem:expr, $($message:tt)*) => ({
30-
$context.tcx().sess.span_warn(
31-
$context.last_span,
32-
&format!("broken MIR ({:?}): {}", $elem, format!($($message)*))
33-
)
34+
mirbug($context.tcx(), $context.last_span,
35+
&format!("broken MIR ({:?}): {}", $elem, format!($($message)*)))
3436
})
3537
}
3638

3739
macro_rules! span_mirbug_and_err {
3840
($context:expr, $elem:expr, $($message:tt)*) => ({
3941
{
40-
$context.tcx().sess.span_warn(
41-
$context.last_span,
42-
&format!("broken MIR ({:?}): {:?}", $elem, format!($($message)*))
43-
);
42+
span_mirbug!($context, $elem, $($message)*);
4443
$context.error()
4544
}
4645
})

0 commit comments

Comments
 (0)