about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhyd-dev <yd-huang@outlook.com>2020-11-09 22:32:58 +0800
committerhyd-dev <yd-huang@outlook.com>2020-11-10 00:15:07 +0800
commit70e175b551f4d1c1b310ef616ba06454030db77e (patch)
treedc6d295460d25c93a4cc41f918ae1937f100c6c3
parent25f6938da459a57b43bdf16ed6bdad3225b2a3ce (diff)
downloadrust-70e175b551f4d1c1b310ef616ba06454030db77e.tar.gz
rust-70e175b551f4d1c1b310ef616ba06454030db77e.zip
Add missing newline to error message of the default OOM hook
-rw-r--r--library/std/src/alloc.rs2
-rw-r--r--src/test/ui/default-alloc-error-hook.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs
index dd760062380..375b015ccc8 100644
--- a/library/std/src/alloc.rs
+++ b/library/std/src/alloc.rs
@@ -316,7 +316,7 @@ pub fn take_alloc_error_hook() -> fn(Layout) {
 }
 
 fn default_alloc_error_hook(layout: Layout) {
-    dumb_print(format_args!("memory allocation of {} bytes failed", layout.size()));
+    dumb_print(format_args!("memory allocation of {} bytes failed\n", layout.size()));
 }
 
 #[cfg(not(test))]
diff --git a/src/test/ui/default-alloc-error-hook.rs b/src/test/ui/default-alloc-error-hook.rs
index 40f61c2b7d5..6871977c798 100644
--- a/src/test/ui/default-alloc-error-hook.rs
+++ b/src/test/ui/default-alloc-error-hook.rs
@@ -16,5 +16,5 @@ fn main() {
     let me = env::current_exe().unwrap();
     let output = Command::new(&me).arg("next").output().unwrap();
     assert!(!output.status.success(), "{:?} is a success", output.status);
-    assert_eq!(str::from_utf8(&output.stderr).unwrap(), "memory allocation of 42 bytes failed");
+    assert_eq!(str::from_utf8(&output.stderr).unwrap(), "memory allocation of 42 bytes failed\n");
 }