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