Commit a339ed1
committed
Auto merge of rust-lang#114528 - dtolnay:globalalloccast, r=cjgillot
Delete some useless casts from global_allocator expansion
These casts are from when #\[global_allocator\] needed to translate back and forth between `*mut u8` and `*mut Opaque`. This should have been cleaned up as part of rust-lang@f6ab74b.
Difference to code generated by `#[global_allocator] static ALLOCATOR: Allocator = Allocator;`:
```diff
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),
- ) as *mut u8
+ )
}
#[rustc_std_internal_symbol]
unsafe fn __rust_dealloc(arg0: *mut u8, arg1: usize, arg2: usize) -> () {
::core::alloc::GlobalAlloc::dealloc(
&ALLOCATOR,
- arg0 as *mut u8,
+ 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 as *mut u8,
+ arg0,
::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
arg3,
- ) as *mut u8
+ )
}
#[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),
- ) as *mut u8
+ )
}
};
```1 file changed
+6
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
| 143 | + | |
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
| |||
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
159 | | - | |
| 158 | + | |
160 | 159 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 160 | + | |
169 | 161 | | |
170 | | - | |
| 162 | + | |
171 | 163 | | |
172 | 164 | | |
173 | 165 | | |
| |||
0 commit comments