Rollup merge of #36880 - durka:debug-unsized-ptr, r=bluss

impl Debug for raw pointers to unsized data

`?Sized` was missing from these impls for seemingly no reason.

Fixes #36870.
This commit is contained in:
Manish Goregaokar 2016-10-01 16:38:33 +05:30 committed by GitHub
commit 987aea5ee4
2 changed files with 5 additions and 2 deletions

View File

@ -1566,11 +1566,11 @@ fn fmt(&self, fmt: &mut Formatter) -> Result {
// 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())