about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-10-01 16:38:33 +0530
committerGitHub <noreply@github.com>2016-10-01 16:38:33 +0530
commit987aea5ee46d3bc49fdace2dab5a795a077481cf (patch)
treeffbbd4c5103d1ed57f16dbc4ebf194198178bbf8 /src
parent9e255704e504c1cf656536f0d430924d4d86f8a8 (diff)
parentba1a49337f8408279e6773818ba4b8215762cb31 (diff)
downloadrust-987aea5ee46d3bc49fdace2dab5a795a077481cf.tar.gz
rust-987aea5ee46d3bc49fdace2dab5a795a077481cf.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/fmt/mod.rs4
-rw-r--r--src/test/run-pass/deriving-show.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index a9f53d3abb8..9aba6703386 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -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) }
 }
 
diff --git a/src/test/run-pass/deriving-show.rs b/src/test/run-pass/deriving-show.rs
index 1f30f3ecedc..e858ba8c823 100644
--- a/src/test/run-pass/deriving-show.rs
+++ b/src/test/run-pass/deriving-show.rs
@@ -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())