You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnstatic_val() -> &'staticmutu8{letrefmut x = 0;
x
}fnmain(){let ref1 = static_val();let ref2 = static_val();*ref1 = 20;*ref2 = 32;println!("{}", ref1);}
The variable x is a mutable reference to a u8 that is promoted to a &'static mut u8. By calling that function multiple times, you can alias the mutable reference in safe Rust.
The text was updated successfully, but these errors were encountered:
The above returns different arrays of values depending on stable, beta, or release channel. Only in debug does table[4] = 20; set the index's value to 20.
The variable x is a mutable reference to a u8 that is promoted to a &'static mut u8. By calling that function multiple times, you can alias the mutable reference in safe Rust.
The text was updated successfully, but these errors were encountered: