2020-07-30 10:27:34 +00:00
|
|
|
// compile-flags: --crate-type=lib
|
|
|
|
// check-pass
|
|
|
|
|
2021-10-04 04:33:43 +00:00
|
|
|
#![feature(const_ptr_is_null)]
|
2023-07-13 12:13:08 +00:00
|
|
|
#![allow(useless_ptr_null_checks)]
|
2020-07-30 10:27:34 +00:00
|
|
|
|
|
|
|
const FOO: &usize = &42;
|
|
|
|
|
|
|
|
pub const _: () = assert!(!(FOO as *const usize).is_null());
|
|
|
|
|
|
|
|
pub const _: () = assert!(!(42 as *const usize).is_null());
|
|
|
|
|
|
|
|
pub const _: () = assert!((0 as *const usize).is_null());
|
|
|
|
|
|
|
|
pub const _: () = assert!(std::ptr::null::<usize>().is_null());
|
|
|
|
|
|
|
|
pub const _: () = assert!(!("foo" as *const str).is_null());
|