Type of the array index not type-checked in reassignment LHS
ironcev opened this issue · comments
Igor Rončević commented
The following script compiles without any errors. The array["test"]
line will emit Internal compiler error: Attempt to load from non-copy type.
but only if the poke(array)
call is there. If that call is removed, even the array["test"]
will not produce any error.
script;
fn main() {
let mut array = [1, 2, 3];
array[0] = 0;
array[0u8] = 0;
array[0u16] = 0;
array[0u32] = 0;
array[0u64] = 0;
array[true] = 0;
array[false] = 0;
array[()] = 0;
// array["test"] = 0;
poke(array);
}
#[inline(never)]
fn poke<T>(_x: T) { }