File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -700,7 +700,7 @@ impl Display for char {
700
700
impl < T > Pointer for * const T {
701
701
fn fmt ( & self , f : & mut Formatter ) -> Result {
702
702
f. flags |= 1 << ( FlagV1 :: Alternate as u32 ) ;
703
- let ret = LowerHex :: fmt ( & ( * self as u32 ) , f) ;
703
+ let ret = LowerHex :: fmt ( & ( * self as usize ) , f) ;
704
704
f. flags &= !( 1 << ( FlagV1 :: Alternate as u32 ) ) ;
705
705
ret
706
706
}
Original file line number Diff line number Diff line change @@ -137,6 +137,13 @@ pub fn main() {
137
137
t ! ( format!( "{:+10.3e}" , 1.2345e6f64 ) , " +1.234e6" ) ;
138
138
t ! ( format!( "{:+10.3e}" , -1.2345e6f64 ) , " -1.234e6" ) ;
139
139
140
+ // Test that pointers don't get truncated.
141
+ {
142
+ let val = usize:: MAX ;
143
+ let exp = format ! ( "{:#x}" , val) ;
144
+ t ! ( format!( "{:p}" , val as * const isize ) , exp) ;
145
+ }
146
+
140
147
// Escaping
141
148
t ! ( format!( "{{" ) , "{" ) ;
142
149
t ! ( format!( "}}" ) , "}" ) ;
You can’t perform that action at this time.
0 commit comments