about summary refs log tree commit diff
path: root/tests/ui/mir/null/addrof_null.rs
blob: 0d0b7edeef620ffded96c277a03356f46b9507f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Make sure that we don't insert a check for `addr_of!`.
//@ run-pass
//@ compile-flags: -C debug-assertions

struct Field {
    a: u32,
}

fn main() {
    unsafe {
        let ptr: *const Field = std::ptr::null();
        let _ptr = core::ptr::addr_of!((*ptr).a);
    }
}