about summary refs log tree commit diff
path: root/tests/codegen/placement-new.rs
AgeCommit message (Collapse)AuthorLines
2025-07-22Rename `tests/codegen` into `tests/codegen-llvm`Guillaume Gomez-39/+0
2025-02-11tests/codegen: use -Copt-level=3 instead of -OJubilee Young-1/+1
2024-10-22add codegen testSlanterns-0/+12
2024-10-10allocate before calling T::default in <Arc<T>>::default()Joshua Wong-2/+2
Same rationale as in the previous commit.
2024-10-10allocate before calling T::default in <Box<T>>::default()Joshua Wong-2/+2
The `Box<T: Default>` impl currently calls `T::default()` before allocating the `Box`. Most `Default` impls are trivial, which should in theory allow LLVM to construct `T: Default` directly in the `Box` allocation when calling `<Box<T>>::default()`. However, the allocation may fail, which necessitates calling `T's` destructor if it has one. If the destructor is non-trivial, then LLVM has a hard time proving that it's sound to elide, which makes it construct `T` on the stack first, and then copy it into the allocation. Create an uninit `Box` first, and then write `T::default` into it, so that LLVM now only needs to prove that the `T::default` can't panic, which should be trivial for most `Default` impls.
2024-10-10add initial tests for placement new changesJoshua Wong-0/+27