2023-12-22 06:10:47 -06:00
|
|
|
//@ compile-flags: --edition 2024 -Z unstable-options
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
unsafe fn _foo() {
|
|
|
|
static mut X: i32 = 1;
|
|
|
|
static mut Y: i32 = 1;
|
|
|
|
|
|
|
|
let _y = &X;
|
2024-02-17 13:01:56 -06:00
|
|
|
//~^ ERROR creating a shared reference to a mutable static [E0796]
|
2023-12-22 06:10:47 -06:00
|
|
|
|
|
|
|
let ref _a = X;
|
2024-02-17 13:01:56 -06:00
|
|
|
//~^ ERROR creating a shared reference to a mutable static [E0796]
|
2023-12-22 06:10:47 -06:00
|
|
|
|
2024-02-17 13:01:56 -06:00
|
|
|
let ref mut _a = X;
|
|
|
|
//~^ ERROR creating a mutable reference to a mutable static [E0796]
|
|
|
|
|
|
|
|
let (_b, _c) = (&X, &mut Y);
|
|
|
|
//~^ ERROR creating a shared reference to a mutable static [E0796]
|
|
|
|
//~^^ ERROR creating a mutable reference to a mutable static [E0796]
|
2023-12-22 06:10:47 -06:00
|
|
|
|
|
|
|
foo(&X);
|
2024-02-17 13:01:56 -06:00
|
|
|
//~^ ERROR creating a shared reference to a mutable static [E0796]
|
2023-12-22 06:10:47 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo<'a>(_x: &'a i32) {}
|