Skip to content

Commit

Permalink
impl Debug for raw pointers to unsized data
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Burka committed Oct 1, 2016
1 parent 50932b5 commit ba1a493
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,11 +1566,11 @@ floating! { f64 }
// Implementation of Display/Debug for various core types

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Debug for *const T {
impl<T: ?Sized> Debug for *const T {
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Debug for *mut T {
impl<T: ?Sized> Debug for *mut T {
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
}

Expand Down
3 changes: 3 additions & 0 deletions src/test/run-pass/deriving-show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ enum Enum {
StructVariant { x: isize, y : usize }
}

#[derive(Debug)]
struct Pointers(*const Send, *mut Sync);

macro_rules! t {
($x:expr, $expected:expr) => {
assert_eq!(format!("{:?}", $x), $expected.to_string())
Expand Down

0 comments on commit ba1a493

Please sign in to comment.