@@ -2461,7 +2461,7 @@ impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
24612461}
24622462
24632463/// Previous name of `NonNull`.
2464- #[ rustc_deprecated( since = "1.24 " , reason = "renamed to `NonNull`" ) ]
2464+ #[ rustc_deprecated( since = "1.25.0 " , reason = "renamed to `NonNull`" ) ]
24652465#[ unstable( feature = "shared" , issue = "27730" ) ]
24662466pub type Shared < T > = NonNull < T > ;
24672467
@@ -2482,12 +2482,12 @@ pub type Shared<T> = NonNull<T>;
24822482/// Usually this won't be necessary; covariance is correct for most safe abstractions,
24832483/// such as Box, Rc, Arc, Vec, and LinkedList. This is the case because they
24842484/// provide a public API that follows the normal shared XOR mutable rules of Rust.
2485- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2485+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
24862486pub struct NonNull < T : ?Sized > {
24872487 pointer : NonZero < * const T > ,
24882488}
24892489
2490- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2490+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
24912491impl < T : ?Sized > fmt:: Debug for NonNull < T > {
24922492 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
24932493 fmt:: Pointer :: fmt ( & self . as_ptr ( ) , f)
@@ -2496,20 +2496,20 @@ impl<T: ?Sized> fmt::Debug for NonNull<T> {
24962496
24972497/// `NonNull` pointers are not `Send` because the data they reference may be aliased.
24982498// NB: This impl is unnecessary, but should provide better error messages.
2499- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2499+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25002500impl < T : ?Sized > !Send for NonNull < T > { }
25012501
25022502/// `NonNull` pointers are not `Sync` because the data they reference may be aliased.
25032503// NB: This impl is unnecessary, but should provide better error messages.
2504- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2504+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25052505impl < T : ?Sized > !Sync for NonNull < T > { }
25062506
25072507impl < T : Sized > NonNull < T > {
25082508 /// Creates a new `NonNull` that is dangling, but well-aligned.
25092509 ///
25102510 /// This is useful for initializing types which lazily allocate, like
25112511 /// `Vec::new` does.
2512- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2512+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25132513 pub fn dangling ( ) -> Self {
25142514 unsafe {
25152515 let ptr = mem:: align_of :: < T > ( ) as * mut T ;
@@ -2524,19 +2524,19 @@ impl<T: ?Sized> NonNull<T> {
25242524 /// # Safety
25252525 ///
25262526 /// `ptr` must be non-null.
2527- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2527+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25282528 pub const unsafe fn new_unchecked ( ptr : * mut T ) -> Self {
25292529 NonNull { pointer : NonZero :: new_unchecked ( ptr) }
25302530 }
25312531
25322532 /// Creates a new `NonNull` if `ptr` is non-null.
2533- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2533+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25342534 pub fn new ( ptr : * mut T ) -> Option < Self > {
25352535 NonZero :: new ( ptr as * const T ) . map ( |nz| NonNull { pointer : nz } )
25362536 }
25372537
25382538 /// Acquires the underlying `*mut` pointer.
2539- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2539+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25402540 pub fn as_ptr ( self ) -> * mut T {
25412541 self . pointer . get ( ) as * mut T
25422542 }
@@ -2546,7 +2546,7 @@ impl<T: ?Sized> NonNull<T> {
25462546 /// The resulting lifetime is bound to self so this behaves "as if"
25472547 /// it were actually an instance of T that is getting borrowed. If a longer
25482548 /// (unbound) lifetime is needed, use `&*my_ptr.as_ptr()`.
2549- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2549+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25502550 pub unsafe fn as_ref ( & self ) -> & T {
25512551 & * self . as_ptr ( )
25522552 }
@@ -2556,47 +2556,47 @@ impl<T: ?Sized> NonNull<T> {
25562556 /// The resulting lifetime is bound to self so this behaves "as if"
25572557 /// it were actually an instance of T that is getting borrowed. If a longer
25582558 /// (unbound) lifetime is needed, use `&mut *my_ptr.as_ptr()`.
2559- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2559+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25602560 pub unsafe fn as_mut ( & mut self ) -> & mut T {
25612561 & mut * self . as_ptr ( )
25622562 }
25632563}
25642564
2565- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2565+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25662566impl < T : ?Sized > Clone for NonNull < T > {
25672567 fn clone ( & self ) -> Self {
25682568 * self
25692569 }
25702570}
25712571
2572- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2572+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25732573impl < T : ?Sized > Copy for NonNull < T > { }
25742574
2575- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2575+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25762576impl < T : ?Sized , U : ?Sized > CoerceUnsized < NonNull < U > > for NonNull < T > where T : Unsize < U > { }
25772577
2578- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2578+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25792579impl < T : ?Sized > fmt:: Pointer for NonNull < T > {
25802580 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
25812581 fmt:: Pointer :: fmt ( & self . as_ptr ( ) , f)
25822582 }
25832583}
25842584
2585- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2585+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25862586impl < T : ?Sized > From < Unique < T > > for NonNull < T > {
25872587 fn from ( unique : Unique < T > ) -> Self {
25882588 NonNull { pointer : unique. pointer }
25892589 }
25902590}
25912591
2592- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2592+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
25932593impl < ' a , T : ?Sized > From < & ' a mut T > for NonNull < T > {
25942594 fn from ( reference : & ' a mut T ) -> Self {
25952595 NonNull { pointer : NonZero :: from ( reference) }
25962596 }
25972597}
25982598
2599- #[ stable( feature = "nonnull" , since = "1.24 .0" ) ]
2599+ #[ stable( feature = "nonnull" , since = "1.25 .0" ) ]
26002600impl < ' a , T : ?Sized > From < & ' a T > for NonNull < T > {
26012601 fn from ( reference : & ' a T ) -> Self {
26022602 NonNull { pointer : NonZero :: from ( reference) }
0 commit comments