Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing newline to error message of the default OOM hook #78897

Merged
merged 1 commit into from Nov 11, 2020
Merged

Add missing newline to error message of the default OOM hook #78897

merged 1 commit into from Nov 11, 2020

Conversation

ghost
Copy link

@ghost ghost commented Nov 9, 2020

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:

dumb_print(format_args!("fatal runtime error: {}\n", args));

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.

@rust-highfive
Copy link
Collaborator

r? @shepmaster

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2020
@m-ou-se
Copy link
Member

m-ou-se commented Nov 9, 2020

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 9, 2020

📌 Commit 70e175b has been approved by m-ou-se

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 9, 2020
@m-ou-se m-ou-se added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Nov 9, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 11, 2020
…as-schievink

Rollup of 14 pull requests

Successful merges:

 - rust-lang#76765 (Make it more clear what an about async fn's returns when referring to what it returns)
 - rust-lang#78574 (Use check-pass instead of build-pass in regions ui test suite)
 - rust-lang#78669 (Use check-pass instead of build-pass in some consts ui test suits)
 - rust-lang#78847 (Assert that a return place is not used for indexing during integration)
 - rust-lang#78854 (Workaround for "could not fully normalize" ICE )
 - rust-lang#78875 (rustc_target: Further cleanup use of target options)
 - rust-lang#78887 (Add comments to explain memory usage optimization)
 - rust-lang#78890 (comment attribution fix)
 - rust-lang#78896 (Clarified description of write! macro)
 - rust-lang#78897 (Add missing newline to error message of the default OOM hook)
 - rust-lang#78898 (add regression test for rust-lang#78892)
 - rust-lang#78908 ((rustdoc) [src] link for types defined by macros shows invocation, not defintion)
 - rust-lang#78910 (Fix links to stabilized versions of some intrinsics)
 - rust-lang#78912 (Add macro test for min-const-generics)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 354098c into rust-lang:master Nov 11, 2020
@rustbot rustbot added this to the 1.49.0 milestone Nov 11, 2020
@ghost ghost deleted the alloc-error-hook-newline branch November 11, 2020 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants