about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorJane Lusby <jlusby@yaah.dev>2021-10-19 15:23:19 -0700
committerJane Lusby <jlusby@yaah.dev>2022-04-08 09:00:16 -0700
commita87a0d089e793903844ef40851deae48c039f8bb (patch)
tree0c9689d8503b00752ea696976064203150be8171 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent2d5a21f63c98f8a1d5f3c3af93bcb0a8af19af36 (diff)
downloadrust-a87a0d089e793903844ef40851deae48c039f8bb.tar.gz
rust-a87a0d089e793903844ef40851deae48c039f8bb.zip
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>
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions