rust/tests/ui/consts/const_in_pattern/null-raw-ptr-issue-119270.rs
2024-02-16 20:02:50 +00:00

16 lines
332 B
Rust

//@ run-pass
struct NoDerive(#[allow(dead_code)] i32);
#[derive(PartialEq)]
struct WrapEmbedded(*const NoDerive);
const WRAP_UNSAFE_EMBEDDED: &&WrapEmbedded = &&WrapEmbedded(std::ptr::null());
fn main() {
let b = match WRAP_UNSAFE_EMBEDDED {
WRAP_UNSAFE_EMBEDDED => true,
_ => false,
};
assert!(b);
}