Skip to content

Commit 987aea5

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#36870.
2 parents 9e25570 + ba1a493 commit 987aea5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/libcore/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,11 @@ floating! { f64 }
15661566
// Implementation of Display/Debug for various core types
15671567

15681568
#[stable(feature = "rust1", since = "1.0.0")]
1569-
impl<T> Debug for *const T {
1569+
impl<T: ?Sized> Debug for *const T {
15701570
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
15711571
}
15721572
#[stable(feature = "rust1", since = "1.0.0")]
1573-
impl<T> Debug for *mut T {
1573+
impl<T: ?Sized> Debug for *mut T {
15741574
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
15751575
}
15761576

src/test/run-pass/deriving-show.rs

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ enum Enum {
2424
StructVariant { x: isize, y : usize }
2525
}
2626

27+
#[derive(Debug)]
28+
struct Pointers(*const Send, *mut Sync);
29+
2730
macro_rules! t {
2831
($x:expr, $expected:expr) => {
2932
assert_eq!(format!("{:?}", $x), $expected.to_string())

0 commit comments

Comments
 (0)