Skip to content

Commit 6cd9b88

Browse files
committed
fix __rust_alloc_error_handler comment
1 parent 9a74fb7 commit 6cd9b88

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

library/alloc/src/alloc.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ extern "Rust" {
2626
fn __rust_realloc(ptr: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
2727
#[rustc_allocator_nounwind]
2828
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
29-
#[rustc_allocator_nounwind]
30-
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
3129
}
3230

3331
/// The global memory allocator.
@@ -323,6 +321,16 @@ pub(crate) unsafe fn box_free<T: ?Sized>(ptr: Unique<T>) {
323321
}
324322
}
325323

324+
// # Allocation error handler
325+
326+
extern "Rust" {
327+
// This is the magic symbol to call the global alloc error handler. rustc generates
328+
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
329+
// default implementations below (`__rdl_oom`) otherwise.
330+
#[rustc_allocator_nounwind]
331+
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
332+
}
333+
326334
/// Abort on memory allocation error or failure.
327335
///
328336
/// Callers of memory allocation APIs wishing to abort computation

0 commit comments

Comments
 (0)