1# Changelog
2
3## Unreleased
4
5-
6
7## 1.19.0
8
9- Use `portable-atomic` instead of `atomic-polyfill`, [#251](https://github.com/matklad/once_cell/pull/251).
10
11## 1.18.0
12
13- `MSRV` is updated to 1.60.0 to take advantage of `dep:` syntax for cargo features,
14  removing "implementation details" from publicly visible surface.
15
16## 1.17.2
17
18- Avoid unnecessary synchronization in `Lazy::{force,deref}_mut()`, [#231](https://github.com/matklad/once_cell/pull/231).
19
20## 1.17.1
21
22- Make `OnceRef` implementation compliant with [strict provenance](https://github.com/rust-lang/rust/issues/95228).
23
24## 1.17.0
25
26- Add `race::OnceRef` for storing a `&'a T`.
27
28## 1.16.0
29
30- Add `no_std` implementation based on `critical-section`,
31  [#195](https://github.com/matklad/once_cell/pull/195).
32- Deprecate `atomic-polyfill` feature (use the new `critical-section` instead)
33
34## 1.15.0
35
36- Increase minimal supported Rust version to 1.56.0.
37- Implement `UnwindSafe` even if the `std` feature is disabled.
38
39## 1.14.0
40
41- Add extension to `unsync` and `sync` `Lazy` mut API:
42  - `force_mut`
43  - `get_mut`
44
45
46## 1.13.1
47
48- Make implementation compliant with [strict provenance](https://github.com/rust-lang/rust/issues/95228).
49- Upgrade `atomic-polyfill` to `1.0`
50
51## 1.13.0
52
53- Add `Lazy::get`, similar to `OnceCell::get`.
54
55## 1.12.1
56
57- Remove incorrect `debug_assert`.
58
59## 1.12.0
60
61- Add `OnceCell::wait`, a blocking variant of `get`.
62
63## 1.11.0
64
65- Add `OnceCell::with_value` to create initialized `OnceCell` in `const` context.
66- Improve `Clone` implementation for `OnceCell`.
67- Rewrite `parking_lot` version on top of `parking_lot_core`, for even smaller cells!
68
69## 1.10.0
70
71- upgrade `parking_lot` to `0.12.0` (note that this bumps MSRV with `parking_lot` feature enabled to `1.49.0`).
72
73## 1.9.0
74
75- Added an `atomic-polyfill` optional dependency to compile `race` on platforms without atomics
76
77## 1.8.0
78
79- Add `try_insert` API -- a version of `set` that returns a reference.
80
81## 1.7.2
82
83- Improve code size when using parking_lot feature.
84
85## 1.7.1
86
87- Fix `race::OnceBox<T>` to also impl `Default` even if `T` doesn't impl `Default`.
88
89## 1.7.0
90
91- Hide the `race` module behind (default) `race` feature.
92  Turns out that adding `race` by default was a breaking change on some platforms without atomics.
93  In this release, we make the module opt-out.
94  Technically, this is a breaking change for those who use `race` with `no_default_features`.
95  Given that the `race` module itself only several days old, the breakage is deemed acceptable.
96
97## 1.6.0
98
99- Add `Lazy::into_value`
100- Stabilize `once_cell::race` module for "first one wins" no_std-compatible initialization flavor.
101- Migrate from deprecated `compare_and_swap` to `compare_exchange`.
102
103## 1.5.2
104
105- `OnceBox` API uses `Box<T>`.
106  This a breaking change to unstable API.
107
108## 1.5.1
109
110- MSRV is increased to `1.36.0`.
111- document `once_cell::race` module.
112- introduce `alloc` feature for `OnceBox`.
113- fix `OnceBox::set`.
114
115## 1.5.0
116
117- add new `once_cell::race` module for "first one wins" no_std-compatible initialization flavor.
118  The API is provisional, subject to change and is gated by the `unstable` cargo feature.
119
120## 1.4.1
121
122- upgrade `parking_lot` to `0.11.0`
123- make `sync::OnceCell<T>` pass https://doc.rust-lang.org/nomicon/dropck.html#an-escape-hatch[dropck] with `parking_lot` feature enabled.
124  This fixes a (minor) semver-incompatible changed introduced in `1.4.0`
125
126## 1.4.0
127
128- upgrade `parking_lot` to `0.10` (note that this bumps MSRV with `parking_lot` feature enabled to `1.36.0`).
129- add `OnceCell::take`.
130- upgrade crossbeam utils (private dependency) to `0.7`.
131
132## 1.3.1
133
134- remove unnecessary `F: fmt::Debug` bound from `impl fmt::Debug for Lazy<T, F>`.
135
136## 1.3.0
137
138- `Lazy<T>` now implements `DerefMut`.
139- update implementation according to the latest changes in `std`.
140
141## 1.2.0
142
143- add `sync::OnceCell::get_unchecked`.
144
145## 1.1.0
146
147- implement `Default` for `Lazy`: it creates an empty `Lazy<T>` which is initialized with `T::default` on first access.
148- add `OnceCell::get_mut`.
149
150## 1.0.2
151
152- actually add `#![no_std]` attribute if std feature is not enabled.
153
154## 1.0.1
155
156- fix unsoundness in `Lazy<T>` if the initializing function panics. Thanks [@xfix](https://github.com/xfix)!
157- implement `RefUnwindSafe` for `Lazy`.
158- share more code between `std` and `parking_lot` implementations.
159- add F.A.Q section to the docs.
160
161## 1.0.0
162
163- remove `parking_lot` from the list of default features.
164- add `std` default feature. Without `std`, only `unsync` module is supported.
165- implement `Eq` for `OnceCell`.
166- fix wrong `Sync` bound on `sync::Lazy`.
167- run the whole test suite with miri.
168
169## 0.2.7
170
171- New implementation of `sync::OnceCell` if `parking_lot` feature is disabled.
172  It now employs a hand-rolled variant of `std::sync::Once`.
173- `sync::OnceCell::get_or_try_init` works without `parking_lot` as well!
174- document the effects of `parking_lot` feature: same performance but smaller types.
175
176## 0.2.6
177
178- Updated `Lazy`'s `Deref` impl to requires only `FnOnce` instead of `Fn`
179
180## 0.2.5
181
182- `Lazy` requires only `FnOnce` instead of `Fn`
183
184## 0.2.4
185
186- nicer `fmt::Debug` implementation
187
188## 0.2.3
189
190- update `parking_lot` to `0.9.0`
191- fix stacked borrows violation in `unsync::OnceCell::get`
192- implement `Clone` for `sync::OnceCell<T> where T: Clone`
193
194## 0.2.2
195
196- add `OnceCell::into_inner` which consumes a cell and returns an option
197
198## 0.2.1
199
200- implement `sync::OnceCell::get_or_try_init` if `parking_lot` feature is enabled
201- switch internal `unsafe` implementation of `sync::OnceCell` from `Once` to `Mutex`
202- `sync::OnceCell::get_or_init` is twice as fast if cell is already initialized
203- implement `std::panic::RefUnwindSafe` and `std::panic::UnwindSafe` for `OnceCell`
204- better document behavior around panics
205
206## 0.2.0
207
208- MSRV is now 1.31.1
209- `Lazy::new` and `OnceCell::new` are now const-fns
210- `unsync_lazy` and `sync_lazy` macros are removed
211
212## 0.1.8
213
214- update crossbeam-utils to 0.6
215- enable bors-ng
216
217## 0.1.7
218
219- cells implement `PartialEq` and `From`
220- MSRV is down to 1.24.1
221- update `parking_lot` to `0.7.1`
222
223## 0.1.6
224
225- `unsync::OnceCell<T>` is `Clone` if `T` is `Clone`.
226
227## 0.1.5
228
229- No changelog until this point :(
230