@@ -16,13 +16,7 @@ use core::intrinsics::abort;
16
16
#[ cfg( not( no_global_oom_handling) ) ]
17
17
use core:: iter;
18
18
use core:: marker:: { PhantomData , Unpin , Unsize } ;
19
- <<<<<<< unify_box_rc
20
19
use core:: mem:: { self , forget} ;
21
- =======
22
- #[ cfg ( not ( no_global_oom_handling ) ) ]
23
- use core:: mem:: size_of_val ;
24
- use core:: mem:: { self , align_of_val_raw } ;
25
- >>>>>>> master
26
20
use core:: ops:: { CoerceUnsized , Deref , DispatchFromDyn , Receiver } ;
27
21
use core:: pin:: Pin ;
28
22
use core:: ptr:: { self , NonNull } ;
@@ -445,11 +439,8 @@ impl<T> Arc<T> {
445
439
///
446
440
/// assert_eq!(*five, 5)
447
441
/// ```
448
- <<<<<<< unify_box_rc
449
442
#[ inline]
450
- =======
451
443
#[ cfg( not( no_global_oom_handling) ) ]
452
- >>>>>>> master
453
444
#[ unstable( feature = "new_uninit" , issue = "63291" ) ]
454
445
pub fn new_uninit ( ) -> Arc < mem:: MaybeUninit < T > > {
455
446
let alloc = ArcAllocator :: new ( Global ) ;
@@ -484,11 +475,8 @@ impl<T> Arc<T> {
484
475
/// ```
485
476
///
486
477
/// [zeroed]: ../../std/mem/union.MaybeUninit.html#method.zeroed
487
- <<<<<<< unify_box_rc
488
478
#[ inline]
489
- =======
490
479
#[ cfg( not( no_global_oom_handling) ) ]
491
- >>>>>>> master
492
480
#[ unstable( feature = "new_uninit" , issue = "63291" ) ]
493
481
pub fn new_zeroed ( ) -> Arc < mem:: MaybeUninit < T > > {
494
482
let alloc = ArcAllocator :: new ( Global ) ;
@@ -1102,33 +1090,7 @@ impl<T: ?Sized> Arc<T> {
1102
1090
}
1103
1091
1104
1092
impl < T : ?Sized > Arc < T > {
1105
- <<<<<<< unify_box_rc
1106
1093
/// Allocates an `Rc<T>` with sufficient space for
1107
- =======
1108
- /// Allocates an `ArcInner<T>` with sufficient space for
1109
- /// a possibly-unsized inner value where the value has the layout provided.
1110
- ///
1111
- /// The function `mem_to_arcinner` is called with the data pointer
1112
- /// and must return back a (potentially fat)-pointer for the `ArcInner<T>`.
1113
- #[ cfg( not( no_global_oom_handling) ) ]
1114
- unsafe fn allocate_for_layout(
1115
- value_layout: Layout ,
1116
- allocate: impl FnOnce ( Layout ) -> Result <NonNull <[ u8 ] >, AllocError >,
1117
- mem_to_arcinner: impl FnOnce ( * mut u8 ) -> * mut ArcInner <T >,
1118
- ) -> * mut ArcInner <T > {
1119
- // Calculate layout using the given value layout.
1120
- // Previously, layout was calculated on the expression
1121
- // `&*(ptr as *const ArcInner<T>)`, but this created a misaligned
1122
- // reference (see #54908).
1123
- let layout = Layout :: new:: <ArcInner <( ) >>( ) . extend( value_layout) . unwrap( ) . 0 . pad_to_align( ) ;
1124
- unsafe {
1125
- Arc :: try_allocate_for_layout( value_layout, allocate, mem_to_arcinner)
1126
- . unwrap_or_else( |_| handle_alloc_error( layout) )
1127
- }
1128
- }
1129
-
1130
- /// Allocates an `ArcInner<T>` with sufficient space for
1131
- >>>>>>> master
1132
1094
/// a possibly-unsized inner value where the value has the layout provided,
1133
1095
/// returning an error if allocation fails.
1134
1096
///
@@ -1149,7 +1111,6 @@ impl<T: ?Sized> Arc<T> {
1149
1111
ptr
1150
1112
}
1151
1113
1152
- <<<<<<< unify_box_rc
1153
1114
/// Allocates an `Arc<T>` with sufficient space for
1154
1115
/// a possibly-unsized inner value where the value has the layout provided.
1155
1116
///
@@ -1164,12 +1125,6 @@ impl<T: ?Sized> Arc<T> {
1164
1125
mem_to_ptr : impl FnOnce ( NonNull < u8 > ) -> NonNull < T > ,
1165
1126
) -> Result < NonNull < T > , AllocError > {
1166
1127
let ptr = mem_to_ptr ( try_allocate ( alloc, layout, init) ?) ;
1167
- =======
1168
- /// Allocates an `ArcInner<T>` with sufficient space for an unsized inner value.
1169
- #[ cfg( not( no_global_oom_handling) ) ]
1170
- unsafe fn allocate_for_ptr( ptr: * const T ) -> * mut ArcInner <T > {
1171
- // Allocate for the `ArcInner<T>` using the given value.
1172
- >>>>>>> master
1173
1128
unsafe {
1174
1129
ArcAllocator :: < Global > :: prefix ( ptr) . as_ptr ( ) . write ( meta) ;
1175
1130
}
@@ -1208,21 +1163,6 @@ impl<T: ?Sized> Arc<T> {
1208
1163
}
1209
1164
1210
1165
impl < T > Arc < [ T ] > {
1211
- <<<<<<< unify_box_rc
1212
- =======
1213
- /// Allocates an `ArcInner<[T]>` with the given length.
1214
- #[ cfg( not( no_global_oom_handling) ) ]
1215
- unsafe fn allocate_for_slice( len: usize ) -> * mut ArcInner <[ T ] > {
1216
- unsafe {
1217
- Self :: allocate_for_layout(
1218
- Layout :: array:: <T >( len) . unwrap( ) ,
1219
- |layout| Global . allocate( layout) ,
1220
- |mem| ptr:: slice_from_raw_parts_mut( mem as * mut T , len) as * mut ArcInner <[ T ] >,
1221
- )
1222
- }
1223
- }
1224
-
1225
- >>>>>>> master
1226
1166
/// Copy elements from slice into newly allocated Arc<\[T\]>
1227
1167
///
1228
1168
/// Unsafe because the caller must either take ownership or bind `T: Copy`.
0 commit comments