feat(allocator): make Box's PhantomData own the passed in T (#2952)

This commit is contained in:
Boshen 2024-04-13 12:31:40 +08:00 committed by GitHub
parent e651e50bda
commit 063b281c39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -6,12 +6,14 @@ on:
types: [opened, synchronize]
paths:
- 'crates/oxc_parser/**'
- 'crates/oxc_allocator/**'
- '.github/workflows/miri.yml'
push:
branches:
- main
paths:
- 'crates/oxc_parser/**'
- 'crates/oxc_allocator/**'
- '.github/workflows/miri.yml'
concurrency:

View file

@ -20,7 +20,7 @@ use crate::Allocator;
/// A Box without Drop.
/// This is used for over coming self-referential structs.
/// It is a memory leak if the boxed value has a `Drop` implementation.
pub struct Box<'alloc, T: ?Sized>(NonNull<T>, PhantomData<&'alloc T>);
pub struct Box<'alloc, T: ?Sized>(NonNull<T>, PhantomData<(&'alloc (), T)>);
impl<'alloc, T> Box<'alloc, T> {
#[allow(unsafe_code)]