-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove usable_size
APIs
#69609
Remove usable_size
APIs
#69609
Conversation
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.
The doc comments for the changed trait methods need to:
- Explain what the returned
usize
is and how it is different fromlayout.size()
. - Say that simply returning
layout.size()
is enough if your allocator doesn't support this.
@@ -1072,18 +923,17 @@ pub unsafe trait AllocRef { | |||
/// function; clients are expected either to be able to recover from | |||
/// `grow_in_place` failures without aborting, or to fall back on | |||
/// another reallocation method before resorting to an abort. | |||
#[inline] |
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.
Why is this inline when none of the other functions are?
@@ -1153,17 +1003,16 @@ pub unsafe trait AllocRef { | |||
/// function; clients are expected either to be able to recover from | |||
/// `shrink_in_place` failures without aborting, or to fall back | |||
/// on another reallocation method before resorting to an abort. | |||
#[inline] |
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.
Why is this inline when none of the other functions are?
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.
Both cases of #[inline]
are no-ops and just return Err
.
I'll add those snippets to the docs. Thanks for reviewing! |
@Amanieu Do you think this should be mentioned on every allocating method or gobally on the trait? |
I think it should be on all methods. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
I have applied your suggestions and squashed the commits. |
@bors r+ rollup=always |
📌 Commit d8e3557 has been approved by |
Remove `usable_size` APIs This removes the usable size APIs: - remove `usable_size` (obv) - change return type of allocating methods to include the allocated size - remove `_excess` API r? @Amanieu closes rust-lang/wg-allocators#17
Rollup of 9 pull requests Successful merges: - #69565 (miri engine: turn some debug_assert into assert) - #69609 (Remove `usable_size` APIs) - #69620 (doc(librustc_error_codes): add long error explanation for E0719) - #69626 (Toolstate: don't duplicate nightly tool list.) - #69628 (Fix a leak in `DiagnosticBuilder::into_diagnostic`.) - #69633 (Update my mailmap entry) - #69634 (clean up E0378 explanation) - #69637 (Don't convert Results to Options just for matching.) - #69641 (Update books) Failed merges: r? @ghost
Rollup of 9 pull requests Successful merges: - #69213 (Improve documentation on iterators length) - #69609 (Remove `usable_size` APIs) - #69619 (more cleanups) - #69620 (doc(librustc_error_codes): add long error explanation for E0719) - #69626 (Toolstate: don't duplicate nightly tool list.) - #69628 (Fix a leak in `DiagnosticBuilder::into_diagnostic`.) - #69633 (Update my mailmap entry) - #69634 (clean up E0378 explanation) - #69637 (Don't convert Results to Options just for matching.) Failed merges: r? @ghost
This removes the usable size APIs:
usable_size
(obv)_excess
APIr? @Amanieu
closes rust-lang/wg-allocators#17