Unnormalized types in typeck results cause ICEs during MIR validation
compiler-errors opened this issue · 0 comments
compiler-errors commented
fn foo(x: [u8; 4]) {
match x[2] {
b' ' | 0x9..=0xd8 => {
panic!()
}
_ => {}
}
}
fn main() {}This ICEs with a bunch of MIR validation failures:
error: internal compiler error: broken MIR in DefId(0:3 ~ test[3886]::foo) (Le((*_2), const 216_u8)): unexpected comparison types <usize as std::slice::SliceIndex<[u8]>>::Output and u8
--> /home/gh-compiler-errors/test.rs:3:16
|
3 | b' ' | 0x9..=0xd8 => {
| ^^^^^^^^^^
|
This is because we expect for the types in the writeback results to have been as normalized as they can be (at least until they're monomorphized). A lot of code depends on this -- MIR typeck, MIR validation, dead code lints, visibility checker, etc.
We can theoretically fix this by doing something like compiler-errors/rust@b0600ae. Alternatively, we could normalize on the spot in all of the downstream functions, but this has a pretty large footprint.
To test this, it depends on #5 being fixed.