mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-29 21:55:30 +00:00
Generate better function argument names in global_allocator expansion
Generated code for `#[global_allocator] static ALLOCATOR: Allocator = Allocator;`—
**Before:**
```rust
const _: () = {
#[rustc_std_internal_symbol]
unsafe fn __rust_alloc(arg0: usize, arg1: usize) -> *mut u8 {
::core::alloc::GlobalAlloc::alloc(
&ALLOCATOR,
::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
)
}
#[rustc_std_internal_symbol]
unsafe fn __rust_dealloc(arg0: *mut u8, arg1: usize, arg2: usize) -> () {
::core::alloc::GlobalAlloc::dealloc(
&ALLOCATOR,
arg0,
::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
)
}
#[rustc_std_internal_symbol]
unsafe fn __rust_realloc(
arg0: *mut u8,
arg1: usize,
arg2: usize,
arg3: usize,
) -> *mut u8 {
::core::alloc::GlobalAlloc::realloc(
&ALLOCATOR,
arg0,
::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
arg3,
)
}
#[rustc_std_internal_symbol]
unsafe fn __rust_alloc_zeroed(arg0: usize, arg1: usize) -> *mut u8 {
::core::alloc::GlobalAlloc::alloc_zeroed(
&ALLOCATOR,
::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
)
}
};
```
**After:**
```rust
const _: () = {
#[rustc_std_internal_symbol]
unsafe fn __rust_alloc(size: usize, align: usize) -> *mut u8 {
::core::alloc::GlobalAlloc::alloc(
&ALLOCATOR,
::core::alloc::Layout::from_size_align_unchecked(size, align),
)
}
#[rustc_std_internal_symbol]
unsafe fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize) -> () {
::core::alloc::GlobalAlloc::dealloc(
&ALLOCATOR,
ptr,
::core::alloc::Layout::from_size_align_unchecked(size, align),
)
}
#[rustc_std_internal_symbol]
unsafe fn __rust_realloc(
ptr: *mut u8,
size: usize,
align: usize,
new_size: usize,
) -> *mut u8 {
::core::alloc::GlobalAlloc::realloc(
&ALLOCATOR,
ptr,
::core::alloc::Layout::from_size_align_unchecked(size, align),
new_size,
)
}
#[rustc_std_internal_symbol]
unsafe fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8 {
::core::alloc::GlobalAlloc::alloc_zeroed(
&ALLOCATOR,
::core::alloc::Layout::from_size_align_unchecked(size, align),
)
}
};
```