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

fix __rust_alloc_error_handler comment #77738

Merged
merged 3 commits into from
Oct 10, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Oct 9, 2020

__rust_alloc_error_handler was added in the same extern block as the allocator functions, but the comment there was not actually correct for __rust_alloc_error_handler. So move it down to the rest of the default allocator handling with a fixed comment. At least the comment reflects my understanding of what happens, please check carefully. :)

r? @Amanieu Cc @haraldh

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 9, 2020
@RalfJung RalfJung force-pushed the alloc-error-handler-comment branch from 85f1075 to 1e6702c Compare October 9, 2020 09:19
// This is the magic symbol to call the global alloc error handler. rustc generates
// it to call `__rg_oom` if there is a `#[global_allocator]`, or uses the
// default implementations below (`__rdl_oom`) otherwise.
#[rustc_allocator_nounwind]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute leaves me rather uneasy, since the default implementation does unwind... see https://github.com/rust-lang/rust/pull/76448/files#r502291279.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if it is safe or what else could happen. Presumably it will lead to unwinding edges on OOM calls which could have perf impact.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT (accidently removed): If it is safe, please remove... It was blindly copied.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to leave the attribute for now.

@RalfJung RalfJung force-pushed the alloc-error-handler-comment branch from 8e3dfdb to fe07e5d Compare October 9, 2020 09:33
@RalfJung RalfJung force-pushed the alloc-error-handler-comment branch from fe07e5d to 1911d21 Compare October 9, 2020 09:36
@Amanieu
Copy link
Member

Amanieu commented Oct 10, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Oct 10, 2020

📌 Commit b6bedc8 has been approved by Amanieu

@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 Oct 10, 2020
@Amanieu
Copy link
Member

Amanieu commented Oct 10, 2020

@bors rollup

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Oct 10, 2020
…t, r=Amanieu

fix __rust_alloc_error_handler comment

`__rust_alloc_error_handler` was added in the same `extern` block as the allocator functions, but the comment there was not actually correct for `__rust_alloc_error_handler`. So move it down to the rest of the default allocator handling with a fixed comment. At least the comment reflects my understanding of what happens, please check carefully. :)

r? @Amanieu Cc @haraldh
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#77195 (Link to documentation-specific guidelines.)
 - rust-lang#77629 (Cleanup of `eat_while()` in lexer)
 - rust-lang#77709 (Link Vec leak doc to Box)
 - rust-lang#77738 (fix __rust_alloc_error_handler comment)
 - rust-lang#77748 (Dead code cleanup in windows-gnu std)
 - rust-lang#77754 (Add TraitDef::find_map_relevant_impl)
 - rust-lang#77766 (Clarify the debug-related values should take boolean)
 - rust-lang#77777 (doc: disambiguate stat in MetadataExt::as_raw_stat)
 - rust-lang#77782 (Fix typo in error code description)
 - rust-lang#77787 (Update `changelog-seen` in config.toml.example)

Failed merges:

r? `@ghost`
@bors bors merged commit b6b6bc0 into rust-lang:master Oct 10, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 10, 2020
@RalfJung RalfJung deleted the alloc-error-handler-comment branch October 11, 2020 21:56
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants