about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-01-03 17:19:26 -0800
committerGitHub <noreply@github.com>2023-01-03 17:19:26 -0800
commitf6b0f4707bcda7b57279f9534a999dc4419f60d1 (patch)
tree3ad1434cd797eb890aceec044b321a93d3246ffe /library/std/src
parentc56d8eda4677c89c1a5e2771dbe637312a6f630f (diff)
parent5974f6f0a53614e82df9430b95bcb6e9473265fa (diff)
downloadrust-f6b0f4707bcda7b57279f9534a999dc4419f60d1.tar.gz
rust-f6b0f4707bcda7b57279f9534a999dc4419f60d1.zip
Rollup merge of #106045 - RalfJung:oom-nounwind-panic, r=Amanieu
default OOM handler: use non-unwinding panic, to match std handler

The OOM handler in std will by default abort. This adjusts the default in liballoc to do the same, using the `can_unwind` flag on the panic info to indicate a non-unwinding panic.

In practice this probably makes little difference since the liballoc default will only come into play in no-std situations where people write a custom panic handler, which most likely will not implement unwinding. But still, this seems more consistent.

Cc `@rust-lang/wg-allocators,` https://github.com/rust-lang/rust/issues/66741
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/alloc.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs
index 61c1ff578b2..c5a5991cc81 100644
--- a/library/std/src/alloc.rs
+++ b/library/std/src/alloc.rs
@@ -338,7 +338,7 @@ fn default_alloc_error_hook(layout: Layout) {
 
     #[allow(unused_unsafe)]
     if unsafe { __rust_alloc_error_handler_should_panic != 0 } {
-        panic!("memory allocation of {} bytes failed\n", layout.size());
+        panic!("memory allocation of {} bytes failed", layout.size());
     } else {
         rtprintpanic!("memory allocation of {} bytes failed\n", layout.size());
     }