2 // [thir]compile-flags: -Z thir-unsafeck
7 // Tests that we detect unsafe places (specifically, union fields and
8 // raw pointer dereferences), even when they're matched on while having
9 // an uninhabited type (equivalent to `std::intrinsics::unreachable()`).
12 union Union { unit: (), void: Void }
13 let u = Union { unit: () };
15 //~^ ERROR access to union field is unsafe
19 let ptr = std::ptr::null::<Void>();
21 //~^ ERROR dereference of raw pointer is unsafe