2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2015-04-07 07:40:22 +00:00
|
|
|
use std::ptr;
|
|
|
|
use std::rc::Rc;
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
fn main() {
|
2017-10-23 03:01:00 +00:00
|
|
|
let p: *const u8 = ptr::null();
|
2015-04-07 07:40:22 +00:00
|
|
|
let rc = Rc::new(1usize);
|
|
|
|
let arc = Arc::new(1usize);
|
|
|
|
let b = Box::new("hi");
|
|
|
|
|
|
|
|
let _ = format!("{:p}{:p}{:p}",
|
|
|
|
rc, arc, b);
|
|
|
|
|
2015-04-08 00:53:55 +00:00
|
|
|
if cfg!(target_pointer_width = "32") {
|
|
|
|
assert_eq!(format!("{:#p}", p),
|
|
|
|
"0x00000000");
|
2015-04-10 01:06:01 +00:00
|
|
|
} else {
|
2015-04-08 00:53:55 +00:00
|
|
|
assert_eq!(format!("{:#p}", p),
|
|
|
|
"0x0000000000000000");
|
|
|
|
}
|
2015-04-07 07:40:22 +00:00
|
|
|
assert_eq!(format!("{:p}", p),
|
|
|
|
"0x0");
|
|
|
|
}
|