@@ -18,8 +18,6 @@ enum State<T, F> {
18
18
/// # Examples
19
19
///
20
20
/// ```
21
- /// #![feature(lazy_cell)]
22
- ///
23
21
/// use std::cell::LazyCell;
24
22
///
25
23
/// let lazy: LazyCell<i32> = LazyCell::new(|| {
@@ -36,7 +34,7 @@ enum State<T, F> {
36
34
/// // 92
37
35
/// // 92
38
36
/// ```
39
- #[ unstable ( feature = "lazy_cell" , issue = "109736 " ) ]
37
+ #[ stable ( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
40
38
pub struct LazyCell < T , F = fn ( ) -> T > {
41
39
state : UnsafeCell < State < T , F > > ,
42
40
}
@@ -47,8 +45,6 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
47
45
/// # Examples
48
46
///
49
47
/// ```
50
- /// #![feature(lazy_cell)]
51
- ///
52
48
/// use std::cell::LazyCell;
53
49
///
54
50
/// let hello = "Hello, World!".to_string();
@@ -58,7 +54,8 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
58
54
/// assert_eq!(&*lazy, "HELLO, WORLD!");
59
55
/// ```
60
56
#[ inline]
61
- #[ unstable( feature = "lazy_cell" , issue = "109736" ) ]
57
+ #[ stable( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION" ) ]
58
+ #[ rustc_const_stable( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION" ) ]
62
59
pub const fn new ( f : F ) -> LazyCell < T , F > {
63
60
LazyCell { state : UnsafeCell :: new ( State :: Uninit ( f) ) }
64
61
}
@@ -70,7 +67,6 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
70
67
/// # Examples
71
68
///
72
69
/// ```
73
- /// #![feature(lazy_cell)]
74
70
/// #![feature(lazy_cell_consume)]
75
71
///
76
72
/// use std::cell::LazyCell;
@@ -99,8 +95,6 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
99
95
/// # Examples
100
96
///
101
97
/// ```
102
- /// #![feature(lazy_cell)]
103
- ///
104
98
/// use std::cell::LazyCell;
105
99
///
106
100
/// let lazy = LazyCell::new(|| 92);
@@ -109,7 +103,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
109
103
/// assert_eq!(&*lazy, &92);
110
104
/// ```
111
105
#[ inline]
112
- #[ unstable ( feature = "lazy_cell" , issue = "109736 " ) ]
106
+ #[ stable ( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
113
107
pub fn force ( this : & LazyCell < T , F > ) -> & T {
114
108
// SAFETY:
115
109
// This invalidates any mutable references to the data. The resulting
@@ -173,7 +167,7 @@ impl<T, F> LazyCell<T, F> {
173
167
}
174
168
}
175
169
176
- #[ unstable ( feature = "lazy_cell" , issue = "109736 " ) ]
170
+ #[ stable ( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
177
171
impl < T , F : FnOnce ( ) -> T > Deref for LazyCell < T , F > {
178
172
type Target = T ;
179
173
#[ inline]
@@ -182,7 +176,7 @@ impl<T, F: FnOnce() -> T> Deref for LazyCell<T, F> {
182
176
}
183
177
}
184
178
185
- #[ unstable ( feature = "lazy_cell" , issue = "109736 " ) ]
179
+ #[ stable ( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
186
180
impl < T : Default > Default for LazyCell < T > {
187
181
/// Creates a new lazy value using `Default` as the initializing function.
188
182
#[ inline]
@@ -191,7 +185,7 @@ impl<T: Default> Default for LazyCell<T> {
191
185
}
192
186
}
193
187
194
- #[ unstable ( feature = "lazy_cell" , issue = "109736 " ) ]
188
+ #[ stable ( feature = "lazy_cell" , since = "CURRENT_RUSTC_VERSION " ) ]
195
189
impl < T : fmt:: Debug , F > fmt:: Debug for LazyCell < T , F > {
196
190
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
197
191
let mut d = f. debug_tuple ( "LazyCell" ) ;
0 commit comments