Access alloc field directly in Arc/Rc::into_raw_with_allocator.
... since fn allocator doesn't exist yet.
This commit is contained in:
parent
28cb2d7dfb
commit
c895f6e958
@ -1379,7 +1379,7 @@ pub fn into_raw_with_allocator(this: Self) -> (*const T, A) {
|
||||
let this = mem::ManuallyDrop::new(this);
|
||||
let ptr = Self::as_ptr(&this);
|
||||
// Safety: `this` is ManuallyDrop so the allocator will not be double-dropped
|
||||
let alloc = unsafe { ptr::read(Self::allocator(&this)) };
|
||||
let alloc = unsafe { ptr::read(&this.alloc) };
|
||||
(ptr, alloc)
|
||||
}
|
||||
|
||||
@ -3061,7 +3061,7 @@ pub fn into_raw_with_allocator(self) -> (*const T, A) {
|
||||
let this = mem::ManuallyDrop::new(self);
|
||||
let result = this.as_ptr();
|
||||
// Safety: `this` is ManuallyDrop so the allocator will not be double-dropped
|
||||
let alloc = unsafe { ptr::read(this.allocator()) };
|
||||
let alloc = unsafe { ptr::read(&this.alloc) };
|
||||
(result, alloc)
|
||||
}
|
||||
|
||||
|
@ -1520,7 +1520,7 @@ pub fn into_raw_with_allocator(this: Self) -> (*const T, A) {
|
||||
let this = mem::ManuallyDrop::new(this);
|
||||
let ptr = Self::as_ptr(&this);
|
||||
// Safety: `this` is ManuallyDrop so the allocator will not be double-dropped
|
||||
let alloc = unsafe { ptr::read(Self::allocator(&this)) };
|
||||
let alloc = unsafe { ptr::read(&this.alloc) };
|
||||
(ptr, alloc)
|
||||
}
|
||||
|
||||
@ -2803,7 +2803,7 @@ pub fn into_raw_with_allocator(self) -> (*const T, A) {
|
||||
let this = mem::ManuallyDrop::new(self);
|
||||
let result = this.as_ptr();
|
||||
// Safety: `this` is ManuallyDrop so the allocator will not be double-dropped
|
||||
let alloc = unsafe { ptr::read(Self::allocator(&this)) };
|
||||
let alloc = unsafe { ptr::read(&this.alloc) };
|
||||
(result, alloc)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user