# Error code E0796

Reference of mutable static.

Erroneous code example:

    #![allow(unused)]
    fn main() {
    static mut X: i32 = 23;
    static mut Y: i32 = 24;

    unsafe {
      let y = &X;
      let ref x = X;
      let (x, y) = (&X, &Y);
      foo(&X);
    }

    fn foo<'a>(_x: &'a i32) {}
    }

Mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior.

Reference of mutable static is a hard error from 2024 edition.