@@ -26,20 +26,20 @@ use crate::ops::Deref;
2626/// assert_eq!(value, "Hello, World!");
2727/// assert!(cell.get().is_some());
2828/// ```
29- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
29+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
3030pub struct OnceCell < T > {
3131 // Invariant: written to at most once.
3232 inner : UnsafeCell < Option < T > > ,
3333}
3434
35- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
35+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
3636impl < T > Default for OnceCell < T > {
3737 fn default ( ) -> Self {
3838 Self :: new ( )
3939 }
4040}
4141
42- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
42+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
4343impl < T : fmt:: Debug > fmt:: Debug for OnceCell < T > {
4444 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4545 match self . get ( ) {
@@ -49,7 +49,7 @@ impl<T: fmt::Debug> fmt::Debug for OnceCell<T> {
4949 }
5050}
5151
52- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
52+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
5353impl < T : Clone > Clone for OnceCell < T > {
5454 fn clone ( & self ) -> OnceCell < T > {
5555 let res = OnceCell :: new ( ) ;
@@ -63,17 +63,17 @@ impl<T: Clone> Clone for OnceCell<T> {
6363 }
6464}
6565
66- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
66+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
6767impl < T : PartialEq > PartialEq for OnceCell < T > {
6868 fn eq ( & self , other : & Self ) -> bool {
6969 self . get ( ) == other. get ( )
7070 }
7171}
7272
73- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
73+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
7474impl < T : Eq > Eq for OnceCell < T > { }
7575
76- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
76+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
7777impl < T > From < T > for OnceCell < T > {
7878 fn from ( value : T ) -> Self {
7979 OnceCell { inner : UnsafeCell :: new ( Some ( value) ) }
@@ -82,15 +82,15 @@ impl<T> From<T> for OnceCell<T> {
8282
8383impl < T > OnceCell < T > {
8484 /// Creates a new empty cell.
85- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
85+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
8686 pub const fn new ( ) -> OnceCell < T > {
8787 OnceCell { inner : UnsafeCell :: new ( None ) }
8888 }
8989
9090 /// Gets the reference to the underlying value.
9191 ///
9292 /// Returns `None` if the cell is empty.
93- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
93+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
9494 pub fn get ( & self ) -> Option < & T > {
9595 // Safety: Safe due to `inner`'s invariant
9696 unsafe { & * self . inner . get ( ) } . as_ref ( )
@@ -99,7 +99,7 @@ impl<T> OnceCell<T> {
9999 /// Gets the mutable reference to the underlying value.
100100 ///
101101 /// Returns `None` if the cell is empty.
102- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
102+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
103103 pub fn get_mut ( & mut self ) -> Option < & mut T > {
104104 // Safety: Safe because we have unique access
105105 unsafe { & mut * self . inner . get ( ) } . as_mut ( )
@@ -127,7 +127,7 @@ impl<T> OnceCell<T> {
127127 ///
128128 /// assert!(cell.get().is_some());
129129 /// ```
130- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
130+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
131131 pub fn set ( & self , value : T ) -> Result < ( ) , T > {
132132 // Safety: Safe because we cannot have overlapping mutable borrows
133133 let slot = unsafe { & * self . inner . get ( ) } ;
@@ -168,7 +168,7 @@ impl<T> OnceCell<T> {
168168 /// let value = cell.get_or_init(|| unreachable!());
169169 /// assert_eq!(value, &92);
170170 /// ```
171- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
171+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
172172 pub fn get_or_init < F > ( & self , f : F ) -> & T
173173 where
174174 F : FnOnce ( ) -> T ,
@@ -206,7 +206,7 @@ impl<T> OnceCell<T> {
206206 /// assert_eq!(value, Ok(&92));
207207 /// assert_eq!(cell.get(), Some(&92))
208208 /// ```
209- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
209+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
210210 pub fn get_or_try_init < F , E > ( & self , f : F ) -> Result < & T , E >
211211 where
212212 F : FnOnce ( ) -> Result < T , E > ,
@@ -241,7 +241,7 @@ impl<T> OnceCell<T> {
241241 /// cell.set("hello".to_string()).unwrap();
242242 /// assert_eq!(cell.into_inner(), Some("hello".to_string()));
243243 /// ```
244- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
244+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
245245 pub fn into_inner ( self ) -> Option < T > {
246246 // Because `into_inner` takes `self` by value, the compiler statically verifies
247247 // that it is not currently borrowed. So it is safe to move out `Option<T>`.
@@ -269,7 +269,7 @@ impl<T> OnceCell<T> {
269269 /// assert_eq!(cell.take(), Some("hello".to_string()));
270270 /// assert_eq!(cell.get(), None);
271271 /// ```
272- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
272+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
273273 pub fn take ( & mut self ) -> Option < T > {
274274 mem:: take ( self ) . into_inner ( )
275275 }
@@ -298,13 +298,13 @@ impl<T> OnceCell<T> {
298298/// // 92
299299/// // 92
300300/// ```
301- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
301+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
302302pub struct Lazy < T , F = fn ( ) -> T > {
303303 cell : OnceCell < T > ,
304304 init : Cell < Option < F > > ,
305305}
306306
307- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
307+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
308308impl < T : fmt:: Debug , F > fmt:: Debug for Lazy < T , F > {
309309 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
310310 f. debug_struct ( "Lazy" ) . field ( "cell" , & self . cell ) . field ( "init" , & ".." ) . finish ( )
@@ -329,7 +329,7 @@ impl<T, F> Lazy<T, F> {
329329 /// assert_eq!(&*lazy, "HELLO, WORLD!");
330330 /// # }
331331 /// ```
332- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
332+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
333333 pub const fn new ( init : F ) -> Lazy < T , F > {
334334 Lazy { cell : OnceCell :: new ( ) , init : Cell :: new ( Some ( init) ) }
335335 }
@@ -353,7 +353,7 @@ impl<T, F: FnOnce() -> T> Lazy<T, F> {
353353 /// assert_eq!(Lazy::force(&lazy), &92);
354354 /// assert_eq!(&*lazy, &92);
355355 /// ```
356- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
356+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
357357 pub fn force ( this : & Lazy < T , F > ) -> & T {
358358 this. cell . get_or_init ( || match this. init . take ( ) {
359359 Some ( f) => f ( ) ,
@@ -362,15 +362,15 @@ impl<T, F: FnOnce() -> T> Lazy<T, F> {
362362 }
363363}
364364
365- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
365+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
366366impl < T , F : FnOnce ( ) -> T > Deref for Lazy < T , F > {
367367 type Target = T ;
368368 fn deref ( & self ) -> & T {
369369 Lazy :: force ( self )
370370 }
371371}
372372
373- #[ unstable( feature = "once_cell" , issue = "68198 " ) ]
373+ #[ unstable( feature = "once_cell" , issue = "74465 " ) ]
374374impl < T : Default > Default for Lazy < T > {
375375 /// Creates a new lazy value using `Default` as the initializing function.
376376 fn default ( ) -> Lazy < T > {
0 commit comments