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