@@ -29,7 +29,7 @@ use crate::mem;
2929/// assert_eq!(value, "Hello, World!");
3030/// assert!(cell.get().is_some());
3131/// ```
32- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
32+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
3333pub struct OnceCell < T > {
3434 // Invariant: written to at most once.
3535 inner : UnsafeCell < Option < T > > ,
@@ -39,8 +39,8 @@ impl<T> OnceCell<T> {
3939 /// Creates a new empty cell.
4040 #[ inline]
4141 #[ must_use]
42- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
43- #[ rustc_const_stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
42+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
43+ #[ rustc_const_stable( feature = "once_cell" , since = "1.70.0 " ) ]
4444 pub const fn new ( ) -> OnceCell < T > {
4545 OnceCell { inner : UnsafeCell :: new ( None ) }
4646 }
@@ -49,7 +49,7 @@ impl<T> OnceCell<T> {
4949 ///
5050 /// Returns `None` if the cell is empty.
5151 #[ inline]
52- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
52+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
5353 pub fn get ( & self ) -> Option < & T > {
5454 // SAFETY: Safe due to `inner`'s invariant
5555 unsafe { & * self . inner . get ( ) } . as_ref ( )
@@ -59,7 +59,7 @@ impl<T> OnceCell<T> {
5959 ///
6060 /// Returns `None` if the cell is empty.
6161 #[ inline]
62- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
62+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
6363 pub fn get_mut ( & mut self ) -> Option < & mut T > {
6464 self . inner . get_mut ( ) . as_mut ( )
6565 }
@@ -85,7 +85,7 @@ impl<T> OnceCell<T> {
8585 /// assert!(cell.get().is_some());
8686 /// ```
8787 #[ inline]
88- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
88+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
8989 pub fn set ( & self , value : T ) -> Result < ( ) , T > {
9090 // SAFETY: Safe because we cannot have overlapping mutable borrows
9191 let slot = unsafe { & * self . inner . get ( ) } ;
@@ -125,7 +125,7 @@ impl<T> OnceCell<T> {
125125 /// assert_eq!(value, &92);
126126 /// ```
127127 #[ inline]
128- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
128+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
129129 pub fn get_or_init < F > ( & self , f : F ) -> & T
130130 where
131131 F : FnOnce ( ) -> T ,
@@ -206,7 +206,7 @@ impl<T> OnceCell<T> {
206206 /// assert_eq!(cell.into_inner(), Some("hello".to_string()));
207207 /// ```
208208 #[ inline]
209- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
209+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
210210 pub fn into_inner ( self ) -> Option < T > {
211211 // Because `into_inner` takes `self` by value, the compiler statically verifies
212212 // that it is not currently borrowed. So it is safe to move out `Option<T>`.
@@ -233,21 +233,21 @@ impl<T> OnceCell<T> {
233233 /// assert_eq!(cell.get(), None);
234234 /// ```
235235 #[ inline]
236- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
236+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
237237 pub fn take ( & mut self ) -> Option < T > {
238238 mem:: take ( self ) . into_inner ( )
239239 }
240240}
241241
242- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
242+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
243243impl < T > Default for OnceCell < T > {
244244 #[ inline]
245245 fn default ( ) -> Self {
246246 Self :: new ( )
247247 }
248248}
249249
250- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
250+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
251251impl < T : fmt:: Debug > fmt:: Debug for OnceCell < T > {
252252 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
253253 match self . get ( ) {
@@ -257,7 +257,7 @@ impl<T: fmt::Debug> fmt::Debug for OnceCell<T> {
257257 }
258258}
259259
260- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
260+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
261261impl < T : Clone > Clone for OnceCell < T > {
262262 #[ inline]
263263 fn clone ( & self ) -> OnceCell < T > {
@@ -272,18 +272,18 @@ impl<T: Clone> Clone for OnceCell<T> {
272272 }
273273}
274274
275- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
275+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
276276impl < T : PartialEq > PartialEq for OnceCell < T > {
277277 #[ inline]
278278 fn eq ( & self , other : & Self ) -> bool {
279279 self . get ( ) == other. get ( )
280280 }
281281}
282282
283- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
283+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
284284impl < T : Eq > Eq for OnceCell < T > { }
285285
286- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
286+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
287287impl < T > From < T > for OnceCell < T > {
288288 /// Creates a new `OnceCell<T>` which already contains the given `value`.
289289 #[ inline]
@@ -293,5 +293,5 @@ impl<T> From<T> for OnceCell<T> {
293293}
294294
295295// Just like for `Cell<T>` this isn't needed, but results in nicer error messages.
296- #[ stable( feature = "once_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
296+ #[ stable( feature = "once_cell" , since = "1.70.0 " ) ]
297297impl < T > !Sync for OnceCell < T > { }
0 commit comments