diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-07-02 19:29:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-02 19:29:34 +0200 |
| commit | 1a686c669e70f388e1c9308020d6fda8dcbf04a7 (patch) | |
| tree | 3a4baf3c686f96c6d153d292cfd600d4c334ec84 /compiler/rustc_parse/src | |
| parent | 7c9a03b9697d3d0c833956418d1f4d12dca234c3 (diff) | |
| parent | 8797d54812393baeff99ffe257fa056c3dfdb656 (diff) | |
| download | rust-1a686c669e70f388e1c9308020d6fda8dcbf04a7.tar.gz rust-1a686c669e70f388e1c9308020d6fda8dcbf04a7.zip | |
Rollup merge of #141219 - Amanieu:leak_alloc, r=joboet
Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`
Also applies to `Vec::into_raw_parts`.
The expectation is that you can round-trip these methods with `from_raw`, but this is only true when using the global allocator. With custom allocators you should instead be using `into_raw_with_allocator` and `from_raw_in`.
The implementation of `Box::leak` is changed to use `Box::into_raw_with_allocator` and explicitly leak the allocator (which was already the existing behavior). This is because, for `leak` to be safe, the allocator must not free its underlying backing store. The `Allocator` trait only guarantees that allocated memory remains valid until the allocator is dropped.
Diffstat (limited to 'compiler/rustc_parse/src')
0 files changed, 0 insertions, 0 deletions
