We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ff6ea5 commit 5337f31Copy full SHA for 5337f31
src/test/run-pass/ifmt.rs
@@ -42,6 +42,10 @@ impl fmt::Display for C {
42
macro_rules! t {
43
($a:expr, $b:expr) => { assert_eq!($a, $b) }
44
}
45
+#[cfg(target_pointer_width = "32")]
46
+const PTR: &'static str = "0x00001234";
47
+#[cfg(target_pointer_width = "64")]
48
+const PTR: &'static str = "0x0000000000001234";
49
50
pub fn main() {
51
// Various edge cases without formats
@@ -72,8 +76,8 @@ pub fn main() {
72
76
t!(format!("{:X}", 10_usize), "A");
73
77
t!(format!("{}", "foo"), "foo");
74
78
t!(format!("{}", "foo".to_string()), "foo");
75
- t!(format!("{:p}", 0x1234 as *const isize), "0x1234");
- t!(format!("{:p}", 0x1234 as *mut isize), "0x1234");
79
+ t!(format!("{:p}", 0x1234 as *const isize), PTR);
80
+ t!(format!("{:p}", 0x1234 as *mut isize), PTR);
81
t!(format!("{:x}", A), "aloha");
82
t!(format!("{:X}", B), "adios");
83
t!(format!("foo {} ☃☃☃☃☃☃", "bar"), "foo bar ☃☃☃☃☃☃");
0 commit comments