Rollup merge of #100030 - WaffleLapkin:nice_pointer_sis, r=scottmcm

cleanup code w/ pointers in std a little

Use pointer methods (`byte_add`, `null_mut`, etc) to make code in std a little nicer.
This commit is contained in:
Dylan DPC
2022-08-12 20:39:10 +05:30
committed by GitHub
8 changed files with 33 additions and 26 deletions

View File

@@ -1,15 +1,16 @@
use crate::alloc::{GlobalAlloc, Layout, System};
use crate::ptr::null_mut;
#[stable(feature = "alloc_system_type", since = "1.28.0")]
unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
0 as *mut u8
null_mut()
}
#[inline]
unsafe fn alloc_zeroed(&self, _layout: Layout) -> *mut u8 {
0 as *mut u8
null_mut()
}
#[inline]
@@ -17,6 +18,6 @@ unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn realloc(&self, _ptr: *mut u8, _layout: Layout, _new_size: usize) -> *mut u8 {
0 as *mut u8
null_mut()
}
}