@@ -151,7 +151,7 @@ use core::pin::Pin;
151
151
use core:: ptr:: { self , Unique } ;
152
152
use core:: task:: { Context , Poll } ;
153
153
154
- use crate :: alloc:: { handle_alloc_error, AllocError , Allocator , Global , Layout } ;
154
+ use crate :: alloc:: { handle_alloc_error, AllocError , Allocator , Global , Layout , WriteCloneIntoRaw } ;
155
155
use crate :: borrow:: Cow ;
156
156
use crate :: raw_vec:: RawVec ;
157
157
use crate :: str:: from_boxed_utf8_unchecked;
@@ -1047,28 +1047,6 @@ impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {
1047
1047
}
1048
1048
}
1049
1049
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
-
1072
1050
#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
1073
1051
impl Clone for Box < str > {
1074
1052
fn clone ( & self ) -> Self {
0 commit comments