|
6 | 6 | extern_types, |
7 | 7 | decl_macro, |
8 | 8 | rustc_attrs, |
9 | | - rustc_private, |
10 | 9 | transparent_unions, |
11 | 10 | auto_traits, |
12 | 11 | freeze_impls, |
@@ -595,7 +594,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {} |
595 | 594 | impl<T> Box<T> { |
596 | 595 | pub fn new(val: T) -> Box<T> { |
597 | 596 | unsafe { |
598 | | - let size = size_of::<T>(); |
| 597 | + let size = intrinsics::size_of::<T>(); |
599 | 598 | let ptr = libc::malloc(size); |
600 | 599 | intrinsics::copy(&val as *const T as *const u8, ptr, size); |
601 | 600 | Box(Unique { pointer: NonNull(ptr as *const T), _marker: PhantomData }, Global) |
@@ -647,11 +646,11 @@ pub mod intrinsics { |
647 | 646 | #[rustc_intrinsic] |
648 | 647 | pub fn abort() -> !; |
649 | 648 | #[rustc_intrinsic] |
650 | | - pub const fn size_of<T>() -> usize; |
| 649 | + pub fn size_of<T>() -> usize; |
651 | 650 | #[rustc_intrinsic] |
652 | 651 | pub unsafe fn size_of_val<T: ?::Sized>(val: *const T) -> usize; |
653 | 652 | #[rustc_intrinsic] |
654 | | - pub const fn align_of<T>() -> usize; |
| 653 | + pub fn align_of<T>() -> usize; |
655 | 654 | #[rustc_intrinsic] |
656 | 655 | pub unsafe fn align_of_val<T: ?::Sized>(val: *const T) -> usize; |
657 | 656 | #[rustc_intrinsic] |
@@ -716,23 +715,6 @@ impl<T> Index<usize> for [T] { |
716 | 715 | } |
717 | 716 | } |
718 | 717 |
|
719 | | -pub const fn size_of<T>() -> usize { |
720 | | - <T as SizedTypeProperties>::SIZE |
721 | | -} |
722 | | - |
723 | | -pub const fn align_of<T>() -> usize { |
724 | | - <T as SizedTypeProperties>::ALIGN |
725 | | -} |
726 | | - |
727 | | -trait SizedTypeProperties: Sized { |
728 | | - #[lang = "mem_size_const"] |
729 | | - const SIZE: usize = intrinsics::size_of::<Self>(); |
730 | | - |
731 | | - #[lang = "mem_align_const"] |
732 | | - const ALIGN: usize = intrinsics::align_of::<Self>(); |
733 | | -} |
734 | | -impl<T> SizedTypeProperties for T {} |
735 | | - |
736 | 718 | extern "C" { |
737 | 719 | type VaListImpl; |
738 | 720 | } |
|
0 commit comments