about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-11-10 14:45:28 +0100
committerGitHub <noreply@github.com>2020-11-10 14:45:28 +0100
commit354098ccdd4514c1a9ad0c2d3cb21bc2bdc77ac7 (patch)
treedfa3105b25985bd427c9e1a2acce025d435fba3f /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent87ecb0afacaabea3b2a4555207f1ad44932d2d9a (diff)
parent70e175b551f4d1c1b310ef616ba06454030db77e (diff)
downloadrust-354098ccdd4514c1a9ad0c2d3cb21bc2bdc77ac7.tar.gz
rust-354098ccdd4514c1a9ad0c2d3cb21bc2bdc77ac7.zip
Rollup merge of #78897 - hyd-dev:alloc-error-hook-newline, r=m-ou-se
Add missing newline to error message of the default OOM hook

Currently the default OOM hook in libstd does not end the error message with a newline:
```
memory allocation of 4 bytes failedtimeout: the monitored command dumped core
/playground/tools/entrypoint.sh: line 11:     7 Aborted                 timeout --signal=KILL ${timeout} "$`@"`
```
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=030d8223eb57dfe47ef157709aa26542

This is because the `fmt::Arguments` passed to `dumb_print()` does not end with a newline. All other calls to `dumb_print()` in libstd pass a `\n`-ended `fmt::Arguments` to `dumb_print()`. For example:
https://github.com/rust-lang/rust/blob/25f6938da459a57b43bdf16ed6bdad3225b2a3ce/library/std/src/sys_common/util.rs#L18
I think the `\n` was forgotten in #51264.

This PR appends `\n` to the error string.

~~Note that I didn't add a test, because I didn't find tests for functions in ` library/std/src/alloc.rs` or a test that is similar to the test of this change would be.~~ *Edit: CI told me there is an existing test. Sorry.*
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions