summaryrefslogtreecommitdiffstats
path: root/tests/ui/moves/move-of-addr-of-mut.rs
blob: 19fd7028692d416efbd24898815380220581f730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Ensure that taking a mutable raw ptr to an uninitialized variable does not change its
// initializedness.

struct S;

fn main() {
    let mut x: S;
    std::ptr::addr_of_mut!(x); //~ ERROR E0381

    let y = x; // Should error here if `addr_of_mut` is ever allowed on uninitialized variables
    drop(y);
}