175
175
176
176
use cmp:: Ordering ;
177
177
use fmt:: { self , Debug , Display } ;
178
- use marker:: { PhantomData , Unsize } ;
178
+ use marker:: Unsize ;
179
179
use ops:: { Deref , DerefMut , CoerceUnsized } ;
180
180
181
181
/// A mutable memory location that admits only `Copy` data.
@@ -403,40 +403,40 @@ pub enum BorrowState {
403
403
}
404
404
405
405
/// An error returned by [`RefCell::try_borrow`](struct.RefCell.html#method.try_borrow).
406
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
407
- pub struct BorrowError < ' a , T : ' a + ? Sized > {
408
- marker : PhantomData < & ' a RefCell < T > > ,
406
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
407
+ pub struct BorrowError {
408
+ _private : ( ) ,
409
409
}
410
410
411
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
412
- impl < ' a , T : ? Sized > Debug for BorrowError < ' a , T > {
411
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
412
+ impl Debug for BorrowError {
413
413
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
414
414
f. debug_struct ( "BorrowError" ) . finish ( )
415
415
}
416
416
}
417
417
418
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
419
- impl < ' a , T : ? Sized > Display for BorrowError < ' a , T > {
418
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
419
+ impl Display for BorrowError {
420
420
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
421
421
Display :: fmt ( "already mutably borrowed" , f)
422
422
}
423
423
}
424
424
425
425
/// An error returned by [`RefCell::try_borrow_mut`](struct.RefCell.html#method.try_borrow_mut).
426
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
427
- pub struct BorrowMutError < ' a , T : ' a + ? Sized > {
428
- marker : PhantomData < & ' a RefCell < T > > ,
426
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
427
+ pub struct BorrowMutError {
428
+ _private : ( ) ,
429
429
}
430
430
431
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
432
- impl < ' a , T : ? Sized > Debug for BorrowMutError < ' a , T > {
431
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
432
+ impl Debug for BorrowMutError {
433
433
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
434
434
f. debug_struct ( "BorrowMutError" ) . finish ( )
435
435
}
436
436
}
437
437
438
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
439
- impl < ' a , T : ? Sized > Display for BorrowMutError < ' a , T > {
438
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
439
+ impl Display for BorrowMutError {
440
440
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
441
441
Display :: fmt ( "already borrowed" , f)
442
442
}
@@ -573,8 +573,6 @@ impl<T: ?Sized> RefCell<T> {
573
573
/// # Examples
574
574
///
575
575
/// ```
576
- /// #![feature(try_borrow)]
577
- ///
578
576
/// use std::cell::RefCell;
579
577
///
580
578
/// let c = RefCell::new(5);
@@ -589,15 +587,15 @@ impl<T: ?Sized> RefCell<T> {
589
587
/// assert!(c.try_borrow().is_ok());
590
588
/// }
591
589
/// ```
592
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
590
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
593
591
#[ inline]
594
- pub fn try_borrow ( & self ) -> Result < Ref < T > , BorrowError < T > > {
592
+ pub fn try_borrow ( & self ) -> Result < Ref < T > , BorrowError > {
595
593
match BorrowRef :: new ( & self . borrow ) {
596
594
Some ( b) => Ok ( Ref {
597
595
value : unsafe { & * self . value . get ( ) } ,
598
596
borrow : b,
599
597
} ) ,
600
- None => Err ( BorrowError { marker : PhantomData } ) ,
598
+ None => Err ( BorrowError { _private : ( ) } ) ,
601
599
}
602
600
}
603
601
@@ -654,8 +652,6 @@ impl<T: ?Sized> RefCell<T> {
654
652
/// # Examples
655
653
///
656
654
/// ```
657
- /// #![feature(try_borrow)]
658
- ///
659
655
/// use std::cell::RefCell;
660
656
///
661
657
/// let c = RefCell::new(5);
@@ -667,15 +663,15 @@ impl<T: ?Sized> RefCell<T> {
667
663
///
668
664
/// assert!(c.try_borrow_mut().is_ok());
669
665
/// ```
670
- #[ unstable ( feature = "try_borrow" , issue = "35070 " ) ]
666
+ #[ stable ( feature = "try_borrow" , since = "1.13.0 " ) ]
671
667
#[ inline]
672
- pub fn try_borrow_mut ( & self ) -> Result < RefMut < T > , BorrowMutError < T > > {
668
+ pub fn try_borrow_mut ( & self ) -> Result < RefMut < T > , BorrowMutError > {
673
669
match BorrowRefMut :: new ( & self . borrow ) {
674
670
Some ( b) => Ok ( RefMut {
675
671
value : unsafe { & mut * self . value . get ( ) } ,
676
672
borrow : b,
677
673
} ) ,
678
- None => Err ( BorrowMutError { marker : PhantomData } ) ,
674
+ None => Err ( BorrowMutError { _private : ( ) } ) ,
679
675
}
680
676
}
681
677
0 commit comments