Skip to content

Commit 94e5c27

Browse files
committed
Update libgccjit and mini_core
1 parent c8376e4 commit 94e5c27

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/mini_core.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
451451
drop_in_place(to_drop);
452452
}
453453

454+
#[lang = "unpin"]
455+
pub auto trait Unpin {}
456+
454457
#[lang = "deref"]
455458
pub trait Deref {
456459
type Target: ?Sized;
@@ -486,7 +489,18 @@ impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Uns
486489
#[lang = "owned_box"]
487490
pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A);
488491

489-
impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
492+
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
493+
494+
impl<T> Box<T> {
495+
pub fn new(val: T) -> Box<T> {
496+
unsafe {
497+
let size = intrinsics::size_of::<T>();
498+
let ptr = libc::malloc(size);
499+
intrinsics::copy(&val as *const T as *const u8, ptr, size);
500+
Box(Unique { pointer: NonNull(ptr as *const T), _marker: PhantomData }, Global)
501+
}
502+
}
503+
}
490504

491505
impl<T: ?Sized, A: Allocator> Drop for Box<T, A> {
492506
fn drop(&mut self) {

0 commit comments

Comments
 (0)