Closed
Description
i.e. rust-lang/rfcs#885
This is currently legal and prints 0 1
because a
and ARR[0]
are actually references to temporaries and not to C
and ARR
, but this is confusing as hell.
const C: u8 = 0;
const ARR: [u8; 3] = [1, 2, 3];
fn main() {
let a = &mut C;
*a = 1;
ARR[0] = 4;
println!("{} {}", C, ARR[0]);
}