mirror of
https://git.proxmox.com/git/rustc
synced 2025-05-29 22:40:17 +00:00
13 lines
310 B
Rust
13 lines
310 B
Rust
// 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);
|
|
}
|