-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
default_alloc_error_hook: explain difference to default __rdl_oom in alloc #124059
Conversation
This comment has been minimized.
This comment has been minimized.
Hm, actually there is a subtle difference in behavior... currently the default path taken does not invoke any user-defined code. That seems worth preserving for now. I'll change the PR to just add a comment instead. |
3efa247
to
b5ec268
Compare
b5ec268
to
cb13c4d
Compare
r? libs |
library/std/src/alloc.rs
Outdated
// Crucially, it does *not* call any user-defined code, and therefore there are no potential | ||
// reentrancy issues. That makes it different from the default `__rdl_oom` defined in alloc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no potential reentrancy issues.
innit more like "no potential reentrancy issues aside from the ones we foist on ourselves"?
__rdl_oom
is an awfully descriptive name, congratulations on us for coming up with that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You describe two possible differences, and either of those can independently vary, technically. You should note that __rdl_oom
calls like handle_alloc_error()
or whatever it actually does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to clarify both of these points, does that help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you!
cb13c4d
to
3f6703b
Compare
@bors r+ rollup |
… r=workingjubilee default_alloc_error_hook: explain difference to default __rdl_oom in alloc Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
… r=workingjubilee default_alloc_error_hook: explain difference to default __rdl_oom in alloc Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#122492 (Implement ptr_as_ref_unchecked) - rust-lang#123815 (Fix cannot usage in time.rs) - rust-lang#124059 (default_alloc_error_hook: explain difference to default __rdl_oom in alloc) - rust-lang#124510 (Add raw identifier in a typo suggestion) - rust-lang#124555 (coverage: Clean up creation of MC/DC condition bitmaps) - rust-lang#124593 (Describe and use CStr literals in CStr and CString docs) - rust-lang#124630 (CI: remove `env-x86_64-apple-tests` YAML anchor) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124059 - RalfJung:default_alloc_error_hook, r=workingjubilee default_alloc_error_hook: explain difference to default __rdl_oom in alloc Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.