@@ -2330,8 +2330,9 @@ 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
- #[ unstable( feature = "unique" , reason = "needs an RFC to flesh out design" ,
2334
- issue = "27730" ) ]
2333
+ #[ unstable( feature = "ptr_internals" , issue = "0" ,
2334
+ reason = "use NonNull instead and consider PhantomData<T> \
2335
+ (if you also use #[may_dangle]), Send, and/or Sync") ]
2335
2336
pub struct Unique < T : ?Sized > {
2336
2337
pointer : NonZero < * const T > ,
2337
2338
// NOTE: this marker has no consequences for variance, but is necessary
@@ -2342,7 +2343,7 @@ pub struct Unique<T: ?Sized> {
2342
2343
_marker : PhantomData < T > ,
2343
2344
}
2344
2345
2345
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2346
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2346
2347
impl < T : ?Sized > fmt:: Debug for Unique < T > {
2347
2348
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2348
2349
write ! ( f, "{:p}" , self . as_ptr( ) )
@@ -2353,17 +2354,17 @@ impl<T: ?Sized> fmt::Debug for Unique<T> {
2353
2354
/// reference is unaliased. Note that this aliasing invariant is
2354
2355
/// unenforced by the type system; the abstraction using the
2355
2356
/// `Unique` must enforce it.
2356
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2357
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2357
2358
unsafe impl < T : Send + ?Sized > Send for Unique < T > { }
2358
2359
2359
2360
/// `Unique` pointers are `Sync` if `T` is `Sync` because the data they
2360
2361
/// reference is unaliased. Note that this aliasing invariant is
2361
2362
/// unenforced by the type system; the abstraction using the
2362
2363
/// `Unique` must enforce it.
2363
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2364
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2364
2365
unsafe impl < T : Sync + ?Sized > Sync for Unique < T > { }
2365
2366
2366
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2367
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2367
2368
impl < T : Sized > Unique < T > {
2368
2369
/// Creates a new `Unique` that is dangling, but well-aligned.
2369
2370
///
@@ -2377,14 +2378,13 @@ impl<T: Sized> Unique<T> {
2377
2378
}
2378
2379
}
2379
2380
2380
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2381
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2381
2382
impl < T : ?Sized > Unique < T > {
2382
2383
/// Creates a new `Unique`.
2383
2384
///
2384
2385
/// # Safety
2385
2386
///
2386
2387
/// `ptr` must be non-null.
2387
- #[ unstable( feature = "unique" , issue = "27730" ) ]
2388
2388
pub const unsafe fn new_unchecked ( ptr : * mut T ) -> Self {
2389
2389
Unique { pointer : NonZero :: new_unchecked ( ptr) , _marker : PhantomData }
2390
2390
}
@@ -2418,41 +2418,41 @@ impl<T: ?Sized> Unique<T> {
2418
2418
}
2419
2419
}
2420
2420
2421
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2421
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2422
2422
impl < T : ?Sized > Clone for Unique < T > {
2423
2423
fn clone ( & self ) -> Self {
2424
2424
* self
2425
2425
}
2426
2426
}
2427
2427
2428
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2428
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2429
2429
impl < T : ?Sized > Copy for Unique < T > { }
2430
2430
2431
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2431
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2432
2432
impl < T : ?Sized , U : ?Sized > CoerceUnsized < Unique < U > > for Unique < T > where T : Unsize < U > { }
2433
2433
2434
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2434
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2435
2435
impl < T : ?Sized > fmt:: Pointer for Unique < T > {
2436
2436
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2437
2437
fmt:: Pointer :: fmt ( & self . as_ptr ( ) , f)
2438
2438
}
2439
2439
}
2440
2440
2441
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2441
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2442
2442
impl < ' a , T : ?Sized > From < & ' a mut T > for Unique < T > {
2443
2443
fn from ( reference : & ' a mut T ) -> Self {
2444
2444
Unique { pointer : NonZero :: from ( reference) , _marker : PhantomData }
2445
2445
}
2446
2446
}
2447
2447
2448
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2448
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2449
2449
impl < ' a , T : ?Sized > From < & ' a T > for Unique < T > {
2450
2450
fn from ( reference : & ' a T ) -> Self {
2451
2451
Unique { pointer : NonZero :: from ( reference) , _marker : PhantomData }
2452
2452
}
2453
2453
}
2454
2454
2455
- #[ unstable( feature = "unique " , issue = "27730 " ) ]
2455
+ #[ unstable( feature = "ptr_internals " , issue = "0 " ) ]
2456
2456
impl < ' a , T : ?Sized > From < NonNull < T > > for Unique < T > {
2457
2457
fn from ( p : NonNull < T > ) -> Self {
2458
2458
Unique { pointer : p. pointer , _marker : PhantomData }
0 commit comments