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:
parent
2ecbc22856
commit
4aede75914
@ -25,22 +25,21 @@ use syntax_pos::{Span, DUMMY_SP};
|
|||||||
|
|
||||||
use rustc_data_structures::indexed_vec::Idx;
|
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 {
|
macro_rules! span_mirbug {
|
||||||
($context:expr, $elem:expr, $($message:tt)*) => ({
|
($context:expr, $elem:expr, $($message:tt)*) => ({
|
||||||
$context.tcx().sess.span_warn(
|
mirbug($context.tcx(), $context.last_span,
|
||||||
$context.last_span,
|
&format!("broken MIR ({:?}): {}", $elem, format!($($message)*)))
|
||||||
&format!("broken MIR ({:?}): {}", $elem, format!($($message)*))
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! span_mirbug_and_err {
|
macro_rules! span_mirbug_and_err {
|
||||||
($context:expr, $elem:expr, $($message:tt)*) => ({
|
($context:expr, $elem:expr, $($message:tt)*) => ({
|
||||||
{
|
{
|
||||||
$context.tcx().sess.span_warn(
|
span_mirbug!($context, $elem, $($message)*);
|
||||||
$context.last_span,
|
|
||||||
&format!("broken MIR ({:?}): {:?}", $elem, format!($($message)*))
|
|
||||||
);
|
|
||||||
$context.error()
|
$context.error()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user