Closed
Description
Reduced from core
:
pub struct State {
inner: bool
}
pub fn make() -> State {
State {
inner: true,
}
}
rustc +master-stage1 -Zmir-opt-level=0 -Zmir-enable-passes=+DataflowConstProp --crate-type=lib
Compilation should crash with this error:
rustc: /checkout/src/llvm-project/llvm/lib/IR/Constants.cpp:2216: static Constant *llvm::ConstantExpr::getBitCast(Constant *, Type *, bool): Assertion `CastInst::castIsValid(Instruction::BitCast, C, DstTy) && "Invalid constantexpr bitcast!"' failed.
error: could not compile `core` (lib)
Because we are trying to generate an LLVM bitcast from i1
to i8
.
The MIR dump looks like this:
fn make() -> State {
let mut _0: State;
bb0: {
_0 = const State {{ inner: true }};
return;
}
}
alloc3 (size: 1, align: 1) {
01 │ .
}
I haven't been able to figure out how to produce this MIR without DataflowConstProp.