impl Debug for raw pointers to unsized data

This commit is contained in:
Alex Burka 2016-10-01 01:50:56 +00:00
parent 50932b5f4e
commit ba1a49337f
2 changed files with 5 additions and 2 deletions

View File

@ -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) }
}

View File

@ -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())