Skip to content

Commit b05d71f

Browse files
committed
make std not use &A: Allocator instance
1 parent 7952205 commit b05d71f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/std/src/alloc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl System {
187187
old_size => unsafe {
188188
let new_ptr = self.alloc_impl(new_layout, zeroed)?;
189189
ptr::copy_nonoverlapping(ptr.as_ptr(), new_ptr.as_mut_ptr(), old_size);
190-
Allocator::deallocate(&self, ptr, old_layout);
190+
Allocator::deallocate(self, ptr, old_layout);
191191
Ok(new_ptr)
192192
},
193193
}
@@ -254,7 +254,7 @@ unsafe impl Allocator for System {
254254
match new_layout.size() {
255255
// SAFETY: conditions must be upheld by the caller
256256
0 => unsafe {
257-
Allocator::deallocate(&self, ptr, old_layout);
257+
Allocator::deallocate(self, ptr, old_layout);
258258
Ok(NonNull::slice_from_raw_parts(new_layout.dangling(), 0))
259259
},
260260

@@ -274,9 +274,9 @@ unsafe impl Allocator for System {
274274
// `new_ptr`. Thus, the call to `copy_nonoverlapping` is safe. The safety contract
275275
// for `dealloc` must be upheld by the caller.
276276
new_size => unsafe {
277-
let new_ptr = Allocator::allocate(&self, new_layout)?;
277+
let new_ptr = Allocator::allocate(self, new_layout)?;
278278
ptr::copy_nonoverlapping(ptr.as_ptr(), new_ptr.as_mut_ptr(), new_size);
279-
Allocator::deallocate(&self, ptr, old_layout);
279+
Allocator::deallocate(self, ptr, old_layout);
280280
Ok(new_ptr)
281281
},
282282
}

0 commit comments

Comments
 (0)