Closed
Description
Not that this should ever be done / occur in actual code, but here it is.
Code (playground):
fn main() {
[1][1.5 as usize];
}
Error (formatted):
error: internal compiler error: librustc_mir/transform/const_prop.rs:619: const index not primitive: (
ByRef(
Ptr(
Pointer {
alloc_id: AllocId(0),
offset: Size {
raw: 0
}
}
),
Align {
abi_pow2: 3,
pref_pow2: 3
}
),
TyLayout {
ty: usize,
details: LayoutDetails {
variants: Single {
index: 0
},
fields: Union(0),
abi: Scalar(
Scalar {
value: Int(I64, false),
valid_range: 0..=18446744073709551615
}
),
align: Align {
abi_pow2: 3,
pref_pow2: 3
},
size: Size {
raw: 8
}
}
}, src/main.rs:2:9: 2:12
)
Compiler version: rustc 1.29.0 (aa3ca19 2018-09-11) running on x86_64-unknown-linux-gnu
Compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin