2021-11-11 16:55:58 -06:00
|
|
|
// Ensure that taking a mutable raw ptr to an uninitialized variable does not change its
|
|
|
|
// initializedness.
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x: S;
|
2022-06-21 13:57:45 -05:00
|
|
|
std::ptr::addr_of_mut!(x); //~ ERROR E0381
|
2021-11-11 16:55:58 -06:00
|
|
|
|
|
|
|
let y = x; // Should error here if `addr_of_mut` is ever allowed on uninitialized variables
|
|
|
|
drop(y);
|
|
|
|
}
|