File tree Expand file tree Collapse file tree 3 files changed +3
-35
lines changed Expand file tree Collapse file tree 3 files changed +3
-35
lines changed Original file line number Diff line number Diff line change 9494#![ feature( ptr_offset_from) ]
9595#![ feature( rustc_attrs) ]
9696#![ feature( receiver_trait) ]
97+ #![ feature( slice_from_raw_parts) ]
9798#![ feature( specialization) ]
9899#![ feature( staged_api) ]
99100#![ feature( std_internals) ]
102103#![ feature( try_reserve) ]
103104#![ feature( unboxed_closures) ]
104105#![ feature( unicode_internals) ]
105- #![ feature( untagged_unions) ]
106106#![ feature( unsize) ]
107107#![ feature( unsized_locals) ]
108108#![ feature( allocator_internals) ]
Original file line number Diff line number Diff line change @@ -764,25 +764,9 @@ impl<T: ?Sized> Rc<T> {
764764impl < T > Rc < [ T ] > {
765765 // Allocates an `RcBox<[T]>` with the given length.
766766 unsafe fn allocate_for_slice ( len : usize ) -> * mut RcBox < [ T ] > {
767- // FIXME(#60667): Deduplicate.
768- fn slice_from_raw_parts_mut < T > ( data : * mut T , len : usize ) -> * mut [ T ] {
769- #[ repr( C ) ]
770- union Repr < T > {
771- rust_mut : * mut [ T ] ,
772- raw : FatPtr < T > ,
773- }
774-
775- #[ repr( C ) ]
776- struct FatPtr < T > {
777- data : * const T ,
778- len : usize ,
779- }
780- unsafe { Repr { raw : FatPtr { data, len } } . rust_mut }
781- }
782-
783767 Self :: allocate_for_unsized (
784768 Layout :: array :: < T > ( len) . unwrap ( ) ,
785- |mem| slice_from_raw_parts_mut ( mem as * mut T , len) as * mut RcBox < [ T ] > ,
769+ |mem| ptr :: slice_from_raw_parts_mut ( mem as * mut T , len) as * mut RcBox < [ T ] > ,
786770 )
787771 }
788772}
Original file line number Diff line number Diff line change @@ -652,25 +652,9 @@ impl<T: ?Sized> Arc<T> {
652652impl < T > Arc < [ T ] > {
653653 // Allocates an `ArcInner<[T]>` with the given length.
654654 unsafe fn allocate_for_slice ( len : usize ) -> * mut ArcInner < [ T ] > {
655- // FIXME(#60667): Deduplicate.
656- fn slice_from_raw_parts_mut < T > ( data : * mut T , len : usize ) -> * mut [ T ] {
657- #[ repr( C ) ]
658- union Repr < T > {
659- rust_mut : * mut [ T ] ,
660- raw : FatPtr < T > ,
661- }
662-
663- #[ repr( C ) ]
664- struct FatPtr < T > {
665- data : * const T ,
666- len : usize ,
667- }
668- unsafe { Repr { raw : FatPtr { data, len } } . rust_mut }
669- }
670-
671655 Self :: allocate_for_unsized (
672656 Layout :: array :: < T > ( len) . unwrap ( ) ,
673- |mem| slice_from_raw_parts_mut ( mem as * mut T , len) as * mut ArcInner < [ T ] > ,
657+ |mem| ptr :: slice_from_raw_parts_mut ( mem as * mut T , len) as * mut ArcInner < [ T ] > ,
674658 )
675659 }
676660}
You can’t perform that action at this time.
0 commit comments