@@ -151,7 +151,7 @@ use core::pin::Pin;
151151use core:: ptr:: { self , Unique } ;
152152use core:: task:: { Context , Poll } ;
153153
154- use crate :: alloc:: { handle_alloc_error, AllocError , Allocator , Global , Layout } ;
154+ use crate :: alloc:: { handle_alloc_error, AllocError , Allocator , Global , Layout , WriteCloneIntoRaw } ;
155155use crate :: borrow:: Cow ;
156156use crate :: raw_vec:: RawVec ;
157157use crate :: str:: from_boxed_utf8_unchecked;
@@ -1047,28 +1047,6 @@ impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {
10471047 }
10481048}
10491049
1050- /// Specialize clones into pre-allocated, uninitialized memory.
1051- pub ( crate ) trait WriteCloneIntoRaw : Sized {
1052- unsafe fn write_clone_into_raw ( & self , target : * mut Self ) ;
1053- }
1054-
1055- impl < T : Clone > WriteCloneIntoRaw for T {
1056- #[ inline]
1057- default unsafe fn write_clone_into_raw ( & self , target : * mut Self ) {
1058- // Having allocated *first* may allow the optimizer to create
1059- // the cloned value in-place, skipping the local and move.
1060- unsafe { target. write ( self . clone ( ) ) } ;
1061- }
1062- }
1063-
1064- impl < T : Copy > WriteCloneIntoRaw for T {
1065- #[ inline]
1066- unsafe fn write_clone_into_raw ( & self , target : * mut Self ) {
1067- // We can always copy in-place, without ever involving a local value.
1068- unsafe { target. copy_from_nonoverlapping ( self , 1 ) } ;
1069- }
1070- }
1071-
10721050#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
10731051impl Clone for Box < str > {
10741052 fn clone ( & self ) -> Self {
0 commit comments