2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-04-07 00:40:22 -07:00
|
|
|
use std::ptr;
|
|
|
|
use std::rc::Rc;
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
fn main() {
|
2017-10-22 20:01:00 -07:00
|
|
|
let p: *const u8 = ptr::null();
|
2015-04-07 00:40:22 -07: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-07 17:53:55 -07:00
|
|
|
if cfg!(target_pointer_width = "32") {
|
|
|
|
assert_eq!(format!("{:#p}", p),
|
|
|
|
"0x00000000");
|
2015-04-09 18:06:01 -07:00
|
|
|
} else {
|
2015-04-07 17:53:55 -07:00
|
|
|
assert_eq!(format!("{:#p}", p),
|
|
|
|
"0x0000000000000000");
|
|
|
|
}
|
2015-04-07 00:40:22 -07:00
|
|
|
assert_eq!(format!("{:p}", p),
|
|
|
|
"0x0");
|
|
|
|
}
|