diff options
| author | bors <bors@rust-lang.org> | 2016-02-11 01:54:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-02-11 01:54:15 +0000 |
| commit | 106070b905d1d312e19f7d0e439d1a7e78d3dc05 (patch) | |
| tree | 8aa4ade04e74d30fc04ee5b094128f999db2beda /src/liballoc | |
| parent | 3f4227af139f1da30710a9f07dc28e5a3ccc6fe5 (diff) | |
| parent | c5f73ed80c9c37cceaa25ed20c0f88f9d324bd8c (diff) | |
| download | rust-106070b905d1d312e19f7d0e439d1a7e78d3dc05.tar.gz rust-106070b905d1d312e19f7d0e439d1a7e78d3dc05.zip | |
Auto merge of #31479 - kamalmarhubi:fmt-pointer-unsized, r=alexcrichton
This allows printing pointers to unsized types with the {:p} formatting
directive. The following impls are extended to unsized types:
- impl<'a, T: ?Sized> Pointer for &'a T
- impl<'a, T: ?Sized> Pointer for &'a mut T
- impl<T: ?Sized> Pointer for *const T
- impl<T: ?Sized> Pointer for *mut T
- impl<T: ?Sized> fmt::Pointer for Box<T>
- impl<T: ?Sized> fmt::Pointer for Rc<T>
- impl<T: ?Sized> fmt::Pointer for Arc<T>
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 217d9d7e077..74325afaebd 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -879,7 +879,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> fmt::Pointer for Arc<T> { +impl<T: ?Sized> fmt::Pointer for Arc<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Pointer::fmt(&*self._ptr, f) } diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index be140469eb6..a7cd59d4dfe 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -442,7 +442,7 @@ impl<T: fmt::Debug + ?Sized> fmt::Debug for Box<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> fmt::Pointer for Box<T> { +impl<T: ?Sized> fmt::Pointer for Box<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // It's not possible to extract the inner Uniq directly from the Box, // instead we cast it to a *const which aliases the Unique diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 3c4bea95ba1..162312e2457 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -688,7 +688,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Rc<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> fmt::Pointer for Rc<T> { +impl<T: ?Sized> fmt::Pointer for Rc<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Pointer::fmt(&*self._ptr, f) } |
