Closed
Description
fn foo(x: [u8; 4]) {
match x[2] {
b' ' | 0x9..=0xd8 => {
panic!()
}
_ => {}
}
}
This code currently ICEs with:
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 normalized deeply, and other code (e.g. MIR build, MIR validation, late lints, reachability and dead code analysis) expect that Ty::kind
calls "just work" without any further normalization.
We can either:
- Deeply normalize during writeback (e.g. compiler-errors/rust@b0600ae), or
- Normalize at every site that relies on a "structurally resolved" type mentioned above.