Skip to content

Commit d3be8ab

Browse files
committed
remove the unused exchange_malloc align parameter
`malloc` already returns memory correctly aligned for every possible type in standard C, and that's enough for all types in Rust too
1 parent ed69ef0 commit d3be8ab

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,12 @@ pub fn malloc_raw_dyn(bcx: block,
291291

292292
if heap == heap_exchange {
293293
let llty_value = type_of::type_of(ccx, t);
294-
let llalign = llalign_of_min(ccx, llty_value);
295294

296295
// Allocate space:
297296
let r = callee::trans_lang_call(
298297
bcx,
299298
bcx.tcx().lang_items.exchange_malloc_fn(),
300-
[C_i32(llalign as i32), size],
299+
[size],
301300
None);
302301
rslt(r.bcx, PointerCast(r.bcx, r.val, llty_value.ptr_to()))
303302
} else if heap == heap_exchange_vector {

src/libstd/rt/global_heap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
7676
box as *c_char
7777
}
7878

79-
// FIXME #4942: Make these signatures agree with exchange_alloc's signatures
79+
/// The allocator for unique pointers without contained managed pointers.
8080
#[cfg(not(stage0), not(test))]
8181
#[lang="exchange_malloc"]
8282
#[inline]
83-
pub unsafe fn exchange_malloc(_align: u32, size: uintptr_t) -> *c_char {
83+
pub unsafe fn exchange_malloc(size: uintptr_t) -> *c_char {
8484
malloc_raw(size as uint) as *c_char
8585
}
8686

0 commit comments

Comments
 (0)