]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/ptr_is_null.rs
Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errors
[rust.git] / tests / ui / consts / ptr_is_null.rs
1 // compile-flags: --crate-type=lib
2 // check-pass
3
4 #![feature(const_ptr_is_null)]
5
6 const FOO: &usize = &42;
7
8 pub const _: () = assert!(!(FOO as *const usize).is_null());
9
10 pub const _: () = assert!(!(42 as *const usize).is_null());
11
12 pub const _: () = assert!((0 as *const usize).is_null());
13
14 pub const _: () = assert!(std::ptr::null::<usize>().is_null());
15
16 pub const _: () = assert!(!("foo" as *const str).is_null());