@@ -2330,7 +2330,6 @@ impl<T: ?Sized> PartialOrd for *mut T {
2330
2330
///
2331
2331
/// Unlike `*mut T`, `Unique<T>` is covariant over `T`. This should always be correct
2332
2332
/// for any type which upholds Unique's aliasing requirements.
2333
- #[ allow( missing_debug_implementations) ]
2334
2333
#[ unstable( feature = "unique" , reason = "needs an RFC to flesh out design" ,
2335
2334
issue = "27730" ) ]
2336
2335
pub struct Unique < T : ?Sized > {
@@ -2343,6 +2342,13 @@ pub struct Unique<T: ?Sized> {
2343
2342
_marker : PhantomData < T > ,
2344
2343
}
2345
2344
2345
+ #[ unstable( feature = "unique" , issue = "27730" ) ]
2346
+ impl < T : ?Sized > fmt:: Debug for Unique < T > {
2347
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2348
+ write ! ( f, "{:p}" , self . as_ptr( ) )
2349
+ }
2350
+ }
2351
+
2346
2352
/// `Unique` pointers are `Send` if `T` is `Send` because the data they
2347
2353
/// reference is unaliased. Note that this aliasing invariant is
2348
2354
/// unenforced by the type system; the abstraction using the
@@ -2463,13 +2469,19 @@ impl<'a, T: ?Sized> From<&'a T> for Unique<T> {
2463
2469
/// Usually this won't be necessary; covariance is correct for most safe abstractions,
2464
2470
/// such as Box, Rc, Arc, Vec, and LinkedList. This is the case because they
2465
2471
/// provide a public API that follows the normal shared XOR mutable rules of Rust.
2466
- #[ allow( missing_debug_implementations) ]
2467
2472
#[ unstable( feature = "shared" , reason = "needs an RFC to flesh out design" ,
2468
2473
issue = "27730" ) ]
2469
2474
pub struct Shared < T : ?Sized > {
2470
2475
pointer : NonZero < * const T > ,
2471
2476
}
2472
2477
2478
+ #[ unstable( feature = "shared" , issue = "27730" ) ]
2479
+ impl < T : ?Sized > fmt:: Debug for Shared < T > {
2480
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2481
+ write ! ( f, "{:p}" , self . as_ptr( ) )
2482
+ }
2483
+ }
2484
+
2473
2485
/// `Shared` pointers are not `Send` because the data they reference may be aliased.
2474
2486
// NB: This impl is unnecessary, but should provide better error messages.
2475
2487
#[ unstable( feature = "shared" , issue = "27730" ) ]
0 commit comments