Closed
Description
Code
use std::marker::PhantomData;
const N: usize = 1;
pub struct Elem<M> {
pub x: [usize; N],
pub m: PhantomData<M>,
}
pub fn f() -> Elem<()> {
g()
}
#[inline]
pub fn g<M>() -> Elem<M> {
Elem {
x: [0; N],
m: PhantomData,
}
}
pub fn main() {
f();
}
Error output
error: internal compiler error: src/librustc_middle/ty/subst.rs:529:17: type parameter `M/#0` (M/0) out of range when substituting, substs=[]
...
note: rustc 1.48.0-nightly (d006f5734 2020-08-28) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z mir-opt-level=2
The ICE happens during codegen, but it seems to be caused by MIR inliner.