]> git.proxmox.com Git - rustc.git/blame - src/test/ui/moves/move-of-addr-of-mut.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / moves / move-of-addr-of-mut.rs
CommitLineData
3c0e092e
XL
1// Ensure that taking a mutable raw ptr to an uninitialized variable does not change its
2// initializedness.
3
4struct S;
5
6fn main() {
7 let mut x: S;
064997fb 8 std::ptr::addr_of_mut!(x); //~ ERROR E0381
3c0e092e
XL
9
10 let y = x; // Should error here if `addr_of_mut` is ever allowed on uninitialized variables
11 drop(y);
12}