Commit graph

20 commits

Author SHA1 Message Date
Matthias Krüger 7fb81229d3
Rollup merge of #123803 - Sp00ph:shrink_to_fix, r=Mark-Simulacrum
Fix `VecDeque::shrink_to` UB when `handle_alloc_error` unwinds.

Fixes #123369

For `VecDeque` it's relatively simple to restore the buffer into a consistent state so this PR does just that.

Note that with its current implementation, `shrink_to` may change the internal arrangement of elements in the buffer, so e.g. `[D, <uninit>, A, B, C]` will become `[<uninit>, A, B, C, D]` and `[<uninit>, <uninit>, A, B, C]` may become `[B, C, <uninit>, <uninit>, A]` if `shrink_to` unwinds. This shouldn't be an issue though as we don't make any guarantees about the stability of the internal buffer arrangement (and this case is impossible to hit on stable anyways).

This PR also includes a test with code adapted from #123369 which fails without the new `shrink_to` code. Does this suffice or do we maybe need more exhaustive tests like in #108475?

cc `@Amanieu`

`@rustbot` label +T-libs
2024-05-25 22:15:17 +02:00
Urgau 02eada8f8d Remove now outdated comment since we bumped stage0 2024-05-24 08:08:41 +02:00
Lzu Tao c7d2f4592f addresss reviews 2024-05-21 18:17:55 +00:00
Lzu Tao 0734ae22f5 Update check-cfg lists for alloc 2024-05-21 18:17:55 +00:00
Dion Dokter b8b68983f3
Forward alloc features to core 2024-05-13 22:20:32 +02:00
Dion Dokter 579266a6be Add flag to std and alloc too 2024-05-11 14:20:03 +02:00
Markus Everling 5cb53bc34d Move test_shrink_to_unwind to its own file.
This way, no other test can be tripped up by `test_shrink_to_unwind` changing the alloc error hook.
2024-05-07 19:43:54 +00:00
Maybe Waffle 865ab921ab Rename {collections=>alloc}{tests,benches} 2023-11-26 12:04:56 +00:00
Ben Kimock 2e7364a586 Increase the reach of panic_immediate_abort 2023-10-29 09:31:07 -04:00
Amanieu d'Antras 4a9f292e50 Expose compiler-builtins-weak-intrinsics feature for -Zbuild-std
This was added in rust-lang/compiler-builtins#526 to force all
compiler-builtins intrinsics to use weak linkage.
2023-06-23 11:15:34 +01:00
Matthias Krüger 23a363821d Revert "Report allocation errors as panics"
This reverts commit c9a6e41026.
2023-04-25 00:08:37 +02:00
Amanieu d'Antras c9a6e41026 Report allocation errors as panics 2023-04-16 08:35:44 -07:00
Thom Chiovoloni a4bf36e87b
Update rand in the stdlib tests, and remove the getrandom feature from it 2023-01-04 14:52:41 -08:00
Deadbeef 06a1c14d52
Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
Amanieu d'Antras 5918ee4317 Add support for const operands and options to global_asm!
On x86, the default syntax is also switched to Intel to match asm!
2021-05-13 22:31:57 +01:00
Charles E. Lehner f45fe9493b
Add license metadata for std dependencies 2021-02-21 13:36:18 -05:00
Yuki Okushi 6275a29dbe Update compiler_builtins to 0.1.39 2021-01-07 16:16:36 +09:00
Stefan Lankes 6de51252e0
add options to use optimized and mangled compiler builtins 2020-11-15 08:23:31 +01:00
mark 2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
Renamed from src/liballoc/Cargo.toml (Browse further)