Debian Codegraph @

third_party/rust/bumpalo/CHANGELOG.md

raw
1 ## Unreleased
2
3 Released YYYY-MM-DD.
4
5 ### Added
6
7 * TODO (or remove section if none)
8
9 ### Changed
10
11 * TODO (or remove section if none)
12
13 ### Deprecated
14
15 * TODO (or remove section if none)
16
17 ### Removed
18
19 * TODO (or remove section if none)
20
21 ### Fixed
22
23 * TODO (or remove section if none)
24
25 ### Security
26
27 * TODO (or remove section if none)
28
29 --------------------------------------------------------------------------------
30
31 ## 3.15.4
32
33 Released 2024-03-07.
34
35 ### Added
36
37 * Added the `bumpalo::collections::Vec::extend_from_slices_copy` method, which
38 is a faster way to extend a vec from multiple slices when the element is
39 `Copy` than calling `extend_from_slice_copy` N times.
40
41 --------------------------------------------------------------------------------
42
43 ## 3.15.3
44
45 Released 2024-02-22.
46
47 ### Added
48
49 * Added additional performance improvements to `bumpalo::collections::Vec`
50 related to reserving capacity.
51
52 --------------------------------------------------------------------------------
53
54 ## 3.15.2
55
56 Released 2024-02-21.
57
58 ### Added
59
60 * Add a `bumpalo::collections::Vec::extend_from_slice_copy` method. This doesn't
61 exist on the standard library's `Vec` but they have access to specialization,
62 so their regular `extend_from_slice` has a specialization for `Copy`
63 types. Using this new method for `Copy` types is a ~80x performance
64 improvement over the plain `extend_from_slice` method.
65
66 --------------------------------------------------------------------------------
67
68 ## 3.15.1
69
70 Released 2024-02-20.
71
72 ### Fixed
73
74 * Fixed the MSRV listed in `Cargo.toml`, whose update was forgotten when the
75 MSRV bumped in release 3.15.0.
76
77 --------------------------------------------------------------------------------
78
79 ## 3.15.0
80
81 Released 2024-02-15.
82
83 ### Changed
84
85 * The minimum supported Rust version (MSRV) is now 1.73.0.
86 * `bumpalo::collections::String::push_str` and
87 `bumpalo::collections::String::from_str_in` received significant performance
88 improvements.
89 * Allocator trait methods are now marked `#[inline]`, increasing performance for
90 some callers.
91
92 ### Fixed
93
94 * Fixed an edge-case bug in the `Allocator::shrink` method.
95
96 --------------------------------------------------------------------------------
97
98 ## 3.14.0
99
100 Released 2023-09-14.
101
102 ### Added
103
104 * Added the `std` cargo feature, which enables implementations of `std` traits
105 for various things. Right now that is just `std::io::Write` for
106 `bumpalo::collections::Vec`, but could be more in the future.
107
108 --------------------------------------------------------------------------------
109
110 ## 3.13.0
111
112 Released 2023-05-22.
113
114 ### Added
115
116 * New `"allocator-api2"` feature enables the use of the allocator API on
117 stable. This feature uses a crate that mirrors the API of the unstable Rust
118 `allocator_api` feature. If the feature is enabled, references to `Bump` will
119 implement `allocator_api2::Allocator`. This allows `Bump` to be used as an
120 allocator for collection types from `allocator-api2` and any other crates that
121 support `allocator-api2`.
122
123 ### Changed
124
125 * The minimum supported Rust version (MSRV) is now 1.63.0.
126
127 --------------------------------------------------------------------------------
128
129 ## 3.12.2
130
131 Released 2023-05-09.
132
133 ### Changed
134
135 * Added `rust-version` metadata to `Cargo.toml` which helps `cargo` with version
136 resolution.
137
138 --------------------------------------------------------------------------------
139
140 ## 3.12.1
141
142 Released 2023-04-21.
143
144 ### Fixed
145
146 * Fixed a bug where `Bump::try_with_capacity(n)` where `n > isize::MAX` could
147 lead to attempts to create invalid `Layout`s.
148
149 --------------------------------------------------------------------------------
150
151 ## 3.12.0
152
153 Released 2023-01-17.
154
155 ### Added
156
157 * Added the `bumpalo::boxed::Box::bump` and `bumpalo::collections::String::bump`
158 getters to get the underlying `Bump` that a string or box was allocated into.
159
160 ### Changed
161
162 * Some uses of `Box` that MIRI did not previously consider as UB are now
163 reported as UB, and `bumpalo`'s internals have been adjusted to avoid the new
164 UB.
165
166 --------------------------------------------------------------------------------
167
168 ## 3.11.1
169
170 Released 2022-10-18.
171
172 ### Security
173
174 * Fixed a bug where when `std::vec::IntoIter` was ported to
175 `bumpalo::collections::vec::IntoIter`, it didn't get its underlying `Bump`'s
176 lifetime threaded through. This meant that `rustc` was not checking the
177 borrows for `bumpalo::collections::IntoIter` and this could result in
178 use-after-free bugs.
179
180 --------------------------------------------------------------------------------
181
182 ## 3.11.0
183
184 Released 2022-08-17.
185
186 ### Added
187
188 * Added support for per-`Bump` allocation limits. These are enforced only in the
189 slow path when allocating new chunks in the `Bump`, not in the bump allocation
190 hot path, and therefore impose near zero overhead.
191 * Added the `bumpalo::boxed::Box::into_inner` method.
192
193 ### Changed
194
195 * Updated to Rust 2021 edition.
196 * The minimum supported Rust version (MSRV) is now 1.56.0.
197
198 --------------------------------------------------------------------------------
199
200 ## 3.10.0
201
202 Released 2022-06-01.
203
204 ### Added
205
206 * Implement `bumpalo::collections::FromIteratorIn` for `Option` and `Result`,
207 just like `core` does for `FromIterator`.
208 * Implement `bumpalo::collections::FromIteratorIn` for `bumpalo::boxed::Box<'a,
209 [T]>`.
210 * Added running tests under MIRI in CI for additional confidence in unsafe code.
211 * Publicly exposed `bumpalo::collections::Vec::drain_filter` since the
212 corresponding `std::vec::Vec` method has stabilized.
213
214 ### Changed
215
216 * `Bump::new` will not allocate a backing chunk until the first allocation
217 inside the bump arena now.
218
219 ### Fixed
220
221 * Properly account for alignment changes when growing or shrinking an existing
222 allocation.
223 * Removed all internal integer-to-pointer casts, to play better with UB checkers
224 like MIRI.
225
226 --------------------------------------------------------------------------------
227
228 ## 3.9.1
229
230 Released 2022-01-06.
231
232 ### Fixed
233
234 * Fixed link to logo in docs and README.md
235
236 --------------------------------------------------------------------------------
237
238 ## 3.9.0
239
240 Released 2022-01-05.
241
242 ### Changed
243
244 * The minimum supported Rust version (MSRV) has been raised to Rust 1.54.0.
245
246 * `bumpalo::collections::Vec<T>` implements relevant traits for all arrays of
247 any size `N` via const generics. Previously, it was just arrays up to length
248 32. Similar for `bumpalo::boxed::Box<[T; N]>`.
249
250 --------------------------------------------------------------------------------
251
252 ## 3.8.0
253
254 Released 2021-10-19.
255
256 ### Added
257
258 * Added the `CollectIn` and `FromIteratorIn` traits to make building a
259 collection from an iterator easier. These new traits live in the
260 `bumpalo::collections` module and are implemented by
261 `bumpalo::collections::{String,Vec}`.
262
263 * Added the `Bump::iter_allocated_chunks_raw` method, which is an `unsafe`, raw
264 version of `Bump::iter_allocated_chunks`. The new method does not take an
265 exclusive borrow of the `Bump` and yields raw pointer-and-length pairs for
266 each chunk in the bump. It is the caller's responsibility to ensure that no
267 allocation happens in the `Bump` while iterating over chunks and that there
268 are no active borrows of allocated data if they want to turn any
269 pointer-and-length pairs into slices.
270
271 --------------------------------------------------------------------------------
272
273 ## 3.7.1
274
275 Released 2021-09-17.
276
277 ### Changed
278
279 * The packaged crate uploaded to crates.io when `bumpalo` is published is now
280 smaller, thanks to excluding unnecessary files.
281
282 --------------------------------------------------------------------------------
283
284 ## 3.7.0
285
286 Released 2020-05-28.
287
288 ### Added
289
290 * Added `Borrow` and `BorrowMut` trait implementations for
291 `bumpalo::collections::Vec` and
292 `bumpalo::collections::String`. [#108](https://github.com/fitzgen/bumpalo/pull/108)
293
294 ### Changed
295
296 * When allocating a new chunk fails, don't immediately give up. Instead, try
297 allocating a chunk that is half that size, and if that fails, then try half of
298 *that* size, etc until either we successfully allocate a chunk or we fail to
299 allocate the minimum chunk size and then finally give
300 up. [#111](https://github.com/fitzgen/bumpalo/pull/111)
301
302 --------------------------------------------------------------------------------
303
304 ## 3.6.1
305
306 Released 2020-02-18.
307
308 ### Added
309
310 * Improved performance of `Bump`'s `Allocator::grow_zeroed` trait method
311 implementation. [#99](https://github.com/fitzgen/bumpalo/pull/99)
312
313 --------------------------------------------------------------------------------
314
315 ## 3.6.0
316
317 Released 2020-01-29.
318
319 ### Added
320
321 * Added a few new flavors of allocation:
322
323 * `try_alloc` for fallible, by-value allocation
324
325 * `try_alloc_with` for fallible allocation with an infallible initializer
326 function
327
328 * `alloc_try_with` for infallible allocation with a fallible initializer
329 function
330
331 * `try_alloc_try_with` method for fallible allocation with a fallible
332 initializer function
333
334 We already have infallible, by-value allocation (`alloc`) and infallible
335 allocation with an infallible initializer (`alloc_with`). With these new
336 methods, we now have every combination covered.
337
338 Thanks to [Tamme Schichler](https://github.com/Tamschi) for contributing these
339 methods!
340
341 --------------------------------------------------------------------------------
342
343 ## 3.5.0
344
345 Released 2020-01-22.
346
347 ### Added
348
349 * Added experimental, unstable support for the unstable, nightly Rust
350 `allocator_api` feature.
351
352 The `allocator_api` feature defines an `Allocator` trait and exposes custom
353 allocators for `std` types. Bumpalo has a matching `allocator_api` cargo
354 feature to enable implementing `Allocator` and using `Bump` with `std`
355 collections.
356
357 First, enable the `allocator_api` feature in your `Cargo.toml`:
358
359 ```toml
360 [dependencies]
361 bumpalo = { version = "3.5", features = ["allocator_api"] }
362 ```
363
364 Next, enable the `allocator_api` nightly Rust feature in your `src/lib.rs` or `src/main.rs`:
365
366 ```rust
367 # #[cfg(feature = "allocator_api")]
368 # {
369 #![feature(allocator_api)]
370 # }
371 ```
372
373 Finally, use `std` collections with `Bump`, so that their internal heap
374 allocations are made within the given bump arena:
375
376 ```
377 # #![cfg_attr(feature = "allocator_api", feature(allocator_api))]
378 # #[cfg(feature = "allocator_api")]
379 # {
380 #![feature(allocator_api)]
381 use bumpalo::Bump;
382
383 // Create a new bump arena.
384 let bump = Bump::new();
385
386 // Create a `Vec` whose elements are allocated within the bump arena.
387 let mut v = Vec::new_in(&bump);
388 v.push(0);
389 v.push(1);
390 v.push(2);
391 # }
392 ```
393
394 I'm very excited to see custom allocators in `std` coming along! Thanks to
395 Arthur Gautier for implementing support for the `allocator_api` feature for
396 Bumpalo.
397
398 --------------------------------------------------------------------------------
399
400 ## 3.4.0
401
402 Released 2020-06-01.
403
404 ### Added
405
406 * Added the `bumpalo::boxed::Box<T>` type. It is an owned pointer referencing a
407 bump-allocated value, and it runs `T`'s `Drop` implementation on the
408 referenced value when dropped. This type can be used by enabling the `"boxed"`
409 cargo feature flag.
410
411 --------------------------------------------------------------------------------
412
413 ## 3.3.0
414
415 Released 2020-05-13.
416
417 ### Added
418
419 * Added fallible allocation methods to `Bump`: `try_new`, `try_with_capacity`,
420 and `try_alloc_layout`.
421
422 * Added `Bump::chunk_capacity`
423
424 * Added `bumpalo::collections::Vec::try_reserve[_exact]`
425
426 --------------------------------------------------------------------------------
427
428 ## 3.2.1
429
430 Released 2020-03-24.
431
432 ### Security
433
434 * When `realloc`ing, if we allocate new space, we need to copy the old
435 allocation's bytes into the new space. There are `old_size` number of bytes in
436 the old allocation, but we were accidentally copying `new_size` number of
437 bytes, which could lead to copying bytes into the realloc'd space from past
438 the chunk that we're bump allocating out of, from unknown memory.
439
440 If an attacker can cause `realloc`s, and can read the `realoc`ed data back,
441 this could allow them to read things from other regions of memory that they
442 shouldn't be able to. For example, if some crypto keys happened to live in
443 memory right after a chunk we were bump allocating out of, this could allow
444 the attacker to read the crypto keys.
445
446 Beyond just fixing the bug and adding a regression test, I've also taken two
447 additional steps:
448
449 1. While we were already running the testsuite under `valgrind` in CI, because
450 `valgrind` exits with the same code that the program did, if there are
451 invalid reads/writes that happen not to trigger a segfault, the program can
452 still exit OK and we will be none the wiser. I've enabled the
453 `--error-exitcode=1` flag for `valgrind` in CI so that tests eagerly fail
454 in these scenarios.
455
456 2. I've written a quickcheck test to exercise `realloc`. Without the bug fix
457 in this patch, this quickcheck immediately triggers invalid reads when run
458 under `valgrind`. We didn't previously have quickchecks that exercised
459 `realloc` because `realloc` isn't publicly exposed directly, and instead
460 can only be indirectly called. This new quickcheck test exercises `realloc`
461 via `bumpalo::collections::Vec::resize` and
462 `bumpalo::collections::Vec::shrink_to_fit` calls.
463
464 This bug was introduced in version 3.0.0.
465
466 See [#69](https://github.com/fitzgen/bumpalo/issues/69) for details.
467
468 --------------------------------------------------------------------------------
469
470 ## 3.2.0
471
472 Released 2020-02-07.
473
474 ### Added
475
476 * Added the `bumpalo::collections::Vec::into_bump_slice_mut` method to turn a
477 `bumpalo::collections::Vec<'bump, T>` into a `&'bump mut [T]`.
478
479 --------------------------------------------------------------------------------
480
481 ## 3.1.2
482
483 Released 2020-01-07.
484
485 ### Fixed
486
487 * The `bumpalo::collections::format!` macro did not used to accept a trailing
488 comma like `format!(in bump; "{}", 1,)`, but it does now.
489
490 --------------------------------------------------------------------------------
491
492 ## 3.1.1
493
494 Released 2020-01-03.
495
496 ### Fixed
497
498 * The `bumpalo::collections::vec!` macro did not used to accept a trailing
499 comma like `vec![in bump; 1, 2,]`, but it does now.
500
501 --------------------------------------------------------------------------------
502
503 ## 3.1.0
504
505 Released 2019-12-27.
506
507 ### Added
508
509 * Added the `Bump::allocated_bytes` diagnostic method for counting the total
510 number of bytes a `Bump` has allocated.
511
512 --------------------------------------------------------------------------------
513
514 # 3.0.0
515
516 Released 2019-12-20.
517
518 ## Added
519
520 * Added `Bump::alloc_str` for copying string slices into a `Bump`.
521
522 * Added `Bump::alloc_slice_copy` and `Bump::alloc_slice_clone` for copying or
523 cloning slices into a `Bump`.
524
525 * Added `Bump::alloc_slice_fill_iter` for allocating a slice in the `Bump` from
526 an iterator.
527
528 * Added `Bump::alloc_slice_fill_copy` and `Bump::alloc_slice_fill_clone` for
529 creating slices of length `n` that are filled with copies or clones of an
530 initial element.
531
532 * Added `Bump::alloc_slice_fill_default` for creating slices of length `n` with
533 the element type's default instance.
534
535 * Added `Bump::alloc_slice_fill_with` for creating slices of length `n` whose
536 elements are initialized with a function or closure.
537
538 * Added `Bump::iter_allocated_chunks` as a replacement for the old
539 `Bump::each_allocated_chunk`. The `iter_allocated_chunks` version returns an
540 iterator, which is more idiomatic than its old, callback-taking counterpart.
541 Additionally, `iter_allocated_chunks` exposes the chunks as `MaybeUninit`s
542 instead of slices, which makes it usable in more situations without triggering
543 undefined behavior. See also the note about bump direction in the "changed"
544 section; if you're iterating chunks, you're likely affected by that change!
545
546 * Added `Bump::with_capacity` so that you can pre-allocate a chunk with the
547 requested space.
548
549 ### Changed
550
551 * **BREAKING:** The direction we allocate within a chunk has changed. It used to
552 be "upwards", from low addresses within a chunk towards high addresses. It is
553 now "downwards", from high addresses towards lower addresses.
554
555 Additionally, the order in which we iterate over allocated chunks has changed!
556 We used to iterate over chunks from oldest chunk to youngest chunk, and now we
557 do the opposite: the youngest chunks are iterated over first, and the oldest
558 chunks are iterated over last.
559
560 If you were using `Bump::each_allocated_chunk` to iterate over data that you
561 had previously allocated, and *you want to iterate in order of
562 oldest-to-youngest allocation*, you need to reverse the chunks iterator and
563 also reverse the order in which you loop through the data within a chunk!
564
565 For example, if you had this code:
566
567 ```rust
568 unsafe {
569 bump.each_allocated_chunk(|chunk| {
570 for byte in chunk {
571 // Touch each byte in oldest-to-youngest allocation order...
572 }
573 });
574 }
575 ```
576
577 It should become this code:
578
579 ```rust
580 let mut chunks: Vec<_> = bump.iter_allocated_chunks().collect();
581 chunks.reverse();
582 for chunk in chunks {
583 for byte in chunk.iter().rev() {
584 let byte = unsafe { byte.assume_init() };
585 // Touch each byte in oldest-to-youngest allocation order...
586 }
587 }
588 ```
589
590 The good news is that this change yielded a *speed up in allocation throughput
591 of 3-19%!*
592
593 See https://github.com/fitzgen/bumpalo/pull/37 and
594 https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html for details.
595
596 * **BREAKING:** The `collections` cargo feature is no longer on by default. You
597 must explicitly turn it on if you intend to use the `bumpalo::collections`
598 module.
599
600 * `Bump::reset` will now retain only the last allocated chunk (the biggest),
601 rather than only the first allocated chunk (the smallest). This should enable
602 `Bump` to better adapt to workload sizes and quickly reach a steady state
603 where new chunks are not requested from the global allocator.
604
605 ### Removed
606
607 * The `Bump::each_allocated_chunk` method is removed in favor of
608 `Bump::iter_allocated_chunks`. Note that its safety requirements for reading
609 from the allocated chunks are slightly different from the old
610 `each_allocated_chunk`: only up to 16-byte alignment is supported now. If you
611 allocate anything with greater alignment than that into the bump arena, there
612 might be uninitialized padding inserted in the chunks, and therefore it is no
613 longer safe to read them via `MaybeUninit::assume_init`. See also the note
614 about bump direction in the "changed" section; if you're iterating chunks,
615 you're likely affected by that change!
616
617 * The `std` cargo feature has been removed, since this crate is now always
618 no-std.
619
620 ## Fixed
621
622 * Fixed a bug involving potential integer overflows with large requested
623 allocation sizes.
624
625 --------------------------------------------------------------------------------
626
627 # 2.6.0
628
629 Released 2019-08-19.
630
631 * Implement `Send` for `Bump`.
632
633 --------------------------------------------------------------------------------
634
635 # 2.5.0
636
637 Released 2019-07-01.
638
639 * Add `alloc_slice_copy` and `alloc_slice_clone` methods that allocate space for
640 slices and either copy (with bound `T: Copy`) or clone (with bound `T: Clone`)
641 the provided slice's data into the newly allocated space.
642
643 --------------------------------------------------------------------------------
644
645 # 2.4.3
646
647 Released 2019-05-20.
648
649 * Fixed a bug where chunks were always deallocated with the default chunk
650 layout, not the layout that the chunk was actually allocated with (i.e. if we
651 started growing larger chunks with larger layouts, we would deallocate those
652 chunks with an incorrect layout).
653
654 --------------------------------------------------------------------------------
655
656 # 2.4.2
657
658 Released 2019-05-17.
659
660 * Added an implementation `Default` for `Bump`.
661 * Made it so that if bump allocation within a chunk overflows, we still try to
662 allocate a new chunk to bump out of for the requested allocation. This can
663 avoid some OOMs in scenarios where the chunk we are currently allocating out
664 of is very near the high end of the address space, and there is still
665 available address space lower down for new chunks.
666
667 --------------------------------------------------------------------------------
668
669 # 2.4.1
670
671 Released 2019-04-19.
672
673 * Added readme metadata to Cargo.toml so it shows up on crates.io
674
675 --------------------------------------------------------------------------------
676
677 # 2.4.0
678
679 Released 2019-04-19.
680
681 * Added support for `realloc`ing in-place when the pointer being `realloc`ed is
682 the last allocation made from the bump arena. This should speed up various
683 `String`, `Vec`, and `format!` operations in many cases.
684
685 --------------------------------------------------------------------------------
686
687 # 2.3.0
688
689 Released 2019-03-26.
690
691 * Add the `alloc_with` method, that (usually) avoids stack-allocating the
692 allocated value and then moving it into the bump arena. This avoids potential
693 stack overflows in release mode when allocating very large objects, and also
694 some `memcpy` calls. This is similar to the `copyless` crate. Read [the
695 `alloc_with` doc comments][alloc-with-doc-comments] and [the original issue
696 proposing this API][issue-proposing-alloc-with] for more.
697
698 [alloc-with-doc-comments]: https://github.com/fitzgen/bumpalo/blob/9f47aee8a6839ba65c073b9ad5372aacbbd02352/src/lib.rs#L436-L475
699 [issue-proposing-alloc-with]: https://github.com/fitzgen/bumpalo/issues/10
700
701 --------------------------------------------------------------------------------
702
703 # 2.2.2
704
705 Released 2019-03-18.
706
707 * Fix a regression from 2.2.1 where chunks were not always aligned to the chunk
708 footer's alignment.
709
710 --------------------------------------------------------------------------------
711
712 # 2.2.1
713
714 Released 2019-03-18.
715
716 * Fix a regression in 2.2.0 where newly allocated bump chunks could fail to have
717 capacity for a large requested bump allocation in some corner cases.
718
719 --------------------------------------------------------------------------------
720
721 # 2.2.0
722
723 Released 2019-03-15.
724
725 * Chunks in an arena now start out small, and double in size as more chunks are
726 requested.
727
728 --------------------------------------------------------------------------------
729
730 # 2.1.0
731
732 Released 2019-02-12.
733
734 * Added the `into_bump_slice` method on `bumpalo::collections::Vec<T>`.
735
736 --------------------------------------------------------------------------------
737
738 # 2.0.0
739
740 Released 2019-02-11.
741
742 * Removed the `BumpAllocSafe` trait.
743 * Correctly detect overflows from large allocations and panic.
744
745 --------------------------------------------------------------------------------
746
747 # 1.2.0
748
749 Released 2019-01-15.
750
751 * Fixed an overly-aggressive `debug_assert!` that had false positives.
752 * Ported to Rust 2018 edition.
753
754 --------------------------------------------------------------------------------
755
756 # 1.1.0
757
758 Released 2018-11-28.
759
760 * Added the `collections` module, which contains ports of `std`'s collection
761 types that are compatible with backing their storage in `Bump` arenas.
762 * Lifted the limits on size and alignment of allocations.
763
764 --------------------------------------------------------------------------------
765
766 # 1.0.2
767
768 --------------------------------------------------------------------------------
769
770 # 1.0.1
771
772 --------------------------------------------------------------------------------
773
774 # 1.0.0