]> git.lizzy.rs Git - rust.git/commitdiff
impl Debug for raw pointers to unsized data
authorAlex Burka <durka42@gmail.com>
Sat, 1 Oct 2016 01:50:56 +0000 (01:50 +0000)
committerAlex Burka <durka42@gmail.com>
Sat, 1 Oct 2016 01:50:56 +0000 (01:50 +0000)
src/libcore/fmt/mod.rs
src/test/run-pass/deriving-show.rs

index a9f53d3abb8b913bc6a68fb522654c0ca4022dd6..9aba6703386a2ec2c04e6c245a13d04c4fbbe6df 100644 (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) }
 }
 
index 1f30f3ecedc9682394888654c043a56183794520..e858ba8c823b8537d0d26d71b8cc3e8c50cce10f 100644 (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())