diff options
| author | Antoni Boucher <bouanto@zoho.com> | 2023-06-03 09:34:56 -0400 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2023-06-11 11:41:32 -0400 |
| commit | 94e5c2701228b6fc8d765136967ddc6d51dff6a9 (patch) | |
| tree | aa6090479fd418534c5c0561306c2f4ea9ba139a | |
| parent | c8376e4c78cfdc4d55b6c818fc888a6d62dc08fe (diff) | |
| download | rust-94e5c2701228b6fc8d765136967ddc6d51dff6a9.tar.gz rust-94e5c2701228b6fc8d765136967ddc6d51dff6a9.zip | |
Update libgccjit and mini_core
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | example/mini_core.rs | 16 |
2 files changed, 17 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock index 0f2e152f8ce..1c8754bf675 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,7 @@ dependencies = [ [[package]] name = "gccjit" version = "1.0.0" -source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3" +source = "git+https://github.com/antoyo/gccjit.rs#d6e52626cfc6f487094a5d5ac66302baf3439984" dependencies = [ "gccjit_sys", ] @@ -43,7 +43,7 @@ dependencies = [ [[package]] name = "gccjit_sys" version = "0.0.1" -source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3" +source = "git+https://github.com/antoyo/gccjit.rs#d6e52626cfc6f487094a5d5ac66302baf3439984" dependencies = [ "libc", ] diff --git a/example/mini_core.rs b/example/mini_core.rs index 637b8dc53fe..f0347db00cc 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -451,6 +451,9 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { drop_in_place(to_drop); } +#[lang = "unpin"] +pub auto trait Unpin {} + #[lang = "deref"] pub trait Deref { type Target: ?Sized; @@ -486,7 +489,18 @@ impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Uns #[lang = "owned_box"] pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A); -impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {} +impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {} + +impl<T> Box<T> { + pub fn new(val: T) -> Box<T> { + unsafe { + let size = intrinsics::size_of::<T>(); + let ptr = libc::malloc(size); + intrinsics::copy(&val as *const T as *const u8, ptr, size); + Box(Unique { pointer: NonNull(ptr as *const T), _marker: PhantomData }, Global) + } + } +} impl<T: ?Sized, A: Allocator> Drop for Box<T, A> { fn drop(&mut self) { |
