rust/library/alloc/tests
Jane Lusby a87a0d089e Add ThinBox type for 1 stack pointer sized heap allocated trait objects
Relevant commit messages from squashed history in order:

Add initial version of ThinBox

update test to actually capture failure

swap to middle ptr impl based on matthieu-m's design

Fix stack overflow in debug impl

The previous version would take a `&ThinBox<T>` and deref it once, which
resulted in a no-op and the same type, which it would then print causing
an endless recursion. I've switched to calling `deref` by name to let
method resolution handle deref the correct number of times.

I've also updated the Drop impl for good measure since it seemed like it
could be falling prey to the same bug, and I'll be adding some tests to
verify that the drop is happening correctly.

add test to verify drop is behaving

add doc examples and remove unnecessary Pointee bounds

ThinBox: use NonNull

ThinBox: tests for size

Apply suggestions from code review

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>

use handle_alloc_error and fix drop signature

update niche and size tests

add cfg for allocating APIs

check null before calculating offset

add test for zst and trial usage

prevent optimizer induced ub in drop and cleanup metadata gathering

account for arbitrary size and alignment metadata

Thank you nika and thomcc!

Update library/alloc/src/boxed/thin.rs

Co-authored-by: Josh Triplett <josh@joshtriplett.org>

Update library/alloc/src/boxed/thin.rs

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-04-08 09:00:16 -07:00
..
arc.rs Add Weak may_dangle tests 2021-05-20 19:42:29 -07:00
binary_heap.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
borrow.rs Move various ui const tests to library 2020-09-04 02:35:27 +02:00
boxed.rs Revert accidental stabilization 2022-03-10 14:36:51 +00:00
btree_set_hash.rs Include the length in BTree hashes 2021-10-01 12:29:09 -07:00
const_fns.rs BTree: remove Ord bound from new 2021-08-18 03:55:36 +01:00
cow_str.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
fmt.rs Debug print char 0 as '\0' rather than '\u{0}' 2022-03-27 04:49:10 -07:00
heap.rs Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
lib.rs Add ThinBox type for 1 stack pointer sized heap allocated trait objects 2022-04-08 09:00:16 -07:00
linked_list.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
rc.rs Add Weak may_dangle tests 2021-05-20 19:42:29 -07:00
slice.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
str.rs make utf8_char_counts test faster in Miri 2022-03-31 13:11:44 -04:00
string.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
thin_box.rs Add ThinBox type for 1 stack pointer sized heap allocated trait objects 2022-04-08 09:00:16 -07:00
vec_deque.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
vec.rs add <[[T; N]]>::flatten, <[[T; N]]>::flatten_mut, and Vec::<[T; N]>::into_flattened 2022-04-08 00:54:39 -04:00