Skip to content

Commit 251d44f

Browse files
committed
Fix messed up merge from GitHub
1 parent 3de15d9 commit 251d44f

File tree

2 files changed

+0
-71
lines changed

2 files changed

+0
-71
lines changed

library/alloc/src/raw_vec.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@ use crate::collections::TryReserveError::{self, *};
1818
#[cfg(test)]
1919
mod tests;
2020

21-
<<<<<<< unify_box_rc
22-
=======
23-
#[cfg(not(no_global_oom_handling))]
24-
enum AllocInit {
25-
/// The contents of the new memory are uninitialized.
26-
Uninitialized,
27-
/// The new memory is guaranteed to be zeroed.
28-
Zeroed,
29-
}
30-
31-
>>>>>>> master
3221
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
3322
/// a buffer of memory on the heap without having to worry about all the corner cases
3423
/// involved. This type is excellent for building your own data structures like Vec and VecDeque.

library/alloc/src/sync.rs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ use core::intrinsics::abort;
1616
#[cfg(not(no_global_oom_handling))]
1717
use core::iter;
1818
use core::marker::{PhantomData, Unpin, Unsize};
19-
<<<<<<< unify_box_rc
2019
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
2620
use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver};
2721
use core::pin::Pin;
2822
use core::ptr::{self, NonNull};
@@ -445,11 +439,8 @@ impl<T> Arc<T> {
445439
///
446440
/// assert_eq!(*five, 5)
447441
/// ```
448-
<<<<<<< unify_box_rc
449442
#[inline]
450-
=======
451443
#[cfg(not(no_global_oom_handling))]
452-
>>>>>>> master
453444
#[unstable(feature = "new_uninit", issue = "63291")]
454445
pub fn new_uninit() -> Arc<mem::MaybeUninit<T>> {
455446
let alloc = ArcAllocator::new(Global);
@@ -484,11 +475,8 @@ impl<T> Arc<T> {
484475
/// ```
485476
///
486477
/// [zeroed]: ../../std/mem/union.MaybeUninit.html#method.zeroed
487-
<<<<<<< unify_box_rc
488478
#[inline]
489-
=======
490479
#[cfg(not(no_global_oom_handling))]
491-
>>>>>>> master
492480
#[unstable(feature = "new_uninit", issue = "63291")]
493481
pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
494482
let alloc = ArcAllocator::new(Global);
@@ -1102,33 +1090,7 @@ impl<T: ?Sized> Arc<T> {
11021090
}
11031091

11041092
impl<T: ?Sized> Arc<T> {
1105-
<<<<<<< unify_box_rc
11061093
/// 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
11321094
/// a possibly-unsized inner value where the value has the layout provided,
11331095
/// returning an error if allocation fails.
11341096
///
@@ -1149,7 +1111,6 @@ impl<T: ?Sized> Arc<T> {
11491111
ptr
11501112
}
11511113

1152-
<<<<<<< unify_box_rc
11531114
/// Allocates an `Arc<T>` with sufficient space for
11541115
/// a possibly-unsized inner value where the value has the layout provided.
11551116
///
@@ -1164,12 +1125,6 @@ impl<T: ?Sized> Arc<T> {
11641125
mem_to_ptr: impl FnOnce(NonNull<u8>) -> NonNull<T>,
11651126
) -> Result<NonNull<T>, AllocError> {
11661127
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
11731128
unsafe {
11741129
ArcAllocator::<Global>::prefix(ptr).as_ptr().write(meta);
11751130
}
@@ -1208,21 +1163,6 @@ impl<T: ?Sized> Arc<T> {
12081163
}
12091164

12101165
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
12261166
/// Copy elements from slice into newly allocated Arc<\[T\]>
12271167
///
12281168
/// Unsafe because the caller must either take ownership or bind `T: Copy`.

0 commit comments

Comments
 (0)