Skip to content

Commit ba1a493

Browse files
author
Alex Burka
committed
impl Debug for raw pointers to unsized data
1 parent 50932b5 commit ba1a493

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/libcore/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,11 @@ floating! { f64 }
15661566
// Implementation of Display/Debug for various core types
15671567

15681568
#[stable(feature = "rust1", since = "1.0.0")]
1569-
impl<T> Debug for *const T {
1569+
impl<T: ?Sized> Debug for *const T {
15701570
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
15711571
}
15721572
#[stable(feature = "rust1", since = "1.0.0")]
1573-
impl<T> Debug for *mut T {
1573+
impl<T: ?Sized> Debug for *mut T {
15741574
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
15751575
}
15761576

src/test/run-pass/deriving-show.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ enum Enum {
2424
StructVariant { x: isize, y : usize }
2525
}
2626

27+
#[derive(Debug)]
28+
struct Pointers(*const Send, *mut Sync);
29+
2730
macro_rules! t {
2831
($x:expr, $expected:expr) => {
2932
assert_eq!(format!("{:?}", $x), $expected.to_string())

0 commit comments

Comments
 (0)