]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/move-of-addr-of-mut.rs
Move /src/test to /tests
[rust.git] / tests / ui / moves / move-of-addr-of-mut.rs
1 // Ensure that taking a mutable raw ptr to an uninitialized variable does not change its
2 // initializedness.
3
4 struct S;
5
6 fn main() {
7     let mut x: S;
8     std::ptr::addr_of_mut!(x); //~ ERROR E0381
9
10     let y = x; // Should error here if `addr_of_mut` is ever allowed on uninitialized variables
11     drop(y);
12 }