Commit 1724af9
authored
Rollup merge of #144872 - connortsui20:once-poison-docs, r=Amanieu
Document Poisoning in `LazyCell` and `LazyLock`
Currently, there is no documentation of poisoning behavior in either `LazyCell` or `LazyLock`, even though both of them can be observed as poisoned by users.
`LazyCell` [plagyround example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=9cf38b8dc56db100848f54085c2c697d)
`LazyLock` [playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f1cd6f9fe16636e347ebb695a0ce30c0)
# Open Questions
- [x] Is it worth making the implementation of `LazyLock` more complicated to ensure that the the panic message is `"LazyLock instance has previously been poisoned"` instead of `"Once instance has previously been poisoned"`? See the `LazyLock` playground link above for more context.
- [x] Does it make sense to move `LazyLock` into the `poison` module? It is certainly a poison-able type, but at the same time it is slightly different from the 4 other types currently in the `poison` module in that it is unrecoverable. I think this is more of a libs-api question.
``@rustbot`` label +T-libs-api
Please let me know if these open questions deserve a separate issue / PR!File tree
3 files changed
+118
-5
lines changed- library
- core/src/cell
- std/src/sync
3 files changed
+118
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
18 | 34 | | |
19 | 35 | | |
20 | 36 | | |
| |||
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
67 | 87 | | |
68 | 88 | | |
69 | 89 | | |
| |||
93 | 113 | | |
94 | 114 | | |
95 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
96 | 125 | | |
97 | 126 | | |
98 | 127 | | |
| |||
123 | 152 | | |
124 | 153 | | |
125 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
126 | 164 | | |
127 | 165 | | |
128 | 166 | | |
| |||
219 | 257 | | |
220 | 258 | | |
221 | 259 | | |
222 | | - | |
| 260 | + | |
| 261 | + | |
223 | 262 | | |
224 | 263 | | |
225 | 264 | | |
| |||
245 | 284 | | |
246 | 285 | | |
247 | 286 | | |
248 | | - | |
| 287 | + | |
| 288 | + | |
249 | 289 | | |
250 | 290 | | |
251 | 291 | | |
| |||
278 | 318 | | |
279 | 319 | | |
280 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
281 | 330 | | |
282 | 331 | | |
283 | 332 | | |
| |||
286 | 335 | | |
287 | 336 | | |
288 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
289 | 346 | | |
290 | 347 | | |
291 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
28 | 44 | | |
29 | 45 | | |
30 | 46 | | |
| |||
102 | 118 | | |
103 | 119 | | |
104 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
105 | 125 | | |
106 | 126 | | |
107 | 127 | | |
| |||
136 | 156 | | |
137 | 157 | | |
138 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
139 | 168 | | |
140 | 169 | | |
141 | 170 | | |
| |||
193 | 222 | | |
194 | 223 | | |
195 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
196 | 234 | | |
197 | 235 | | |
198 | 236 | | |
| |||
227 | 265 | | |
228 | 266 | | |
229 | 267 | | |
230 | | - | |
| 268 | + | |
| 269 | + | |
231 | 270 | | |
232 | 271 | | |
233 | 272 | | |
| |||
256 | 295 | | |
257 | 296 | | |
258 | 297 | | |
259 | | - | |
| 298 | + | |
| 299 | + | |
260 | 300 | | |
261 | 301 | | |
262 | 302 | | |
| |||
307 | 347 | | |
308 | 348 | | |
309 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
310 | 358 | | |
311 | 359 | | |
312 | 360 | | |
| |||
315 | 363 | | |
316 | 364 | | |
317 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
318 | 374 | | |
319 | 375 | | |
320 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments