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

Remove usable_size APIs #69609

Merged
merged 1 commit into from
Mar 3, 2020
Merged

Remove usable_size APIs #69609

merged 1 commit into from
Mar 3, 2020

Conversation

TimDiekmann
Copy link
Member

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 1, 2020
Copy link
Member

@Amanieu Amanieu left a 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 from layout.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]
Copy link
Member

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]
Copy link
Member

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?

Copy link
Member Author

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.

@TimDiekmann
Copy link
Member Author

I'll add those snippets to the docs. Thanks for reviewing!

@TimDiekmann
Copy link
Member Author

  • Explain what the returned usize is and how it is different from layout.size().

  • Say that simply returning layout.size() is enough if your allocator doesn't support this.

@Amanieu Do you think this should be mentioned on every allocating method or gobally on the trait?

@Amanieu
Copy link
Member

Amanieu commented Mar 2, 2020

I think it should be on all methods.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-02T20:16:47.3015407Z ========================== Starting Command Output ===========================
2020-03-02T20:16:47.3018334Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/5971294d-6919-4080-ac50-a819bc5f88f5.sh
2020-03-02T20:16:47.3018730Z 
2020-03-02T20:16:47.3024025Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-02T20:16:47.3044334Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69609/merge to s
2020-03-02T20:16:47.3047203Z Task         : Get sources
2020-03-02T20:16:47.3047437Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-02T20:16:47.3047663Z Version      : 1.0.0
2020-03-02T20:16:47.3047890Z Author       : Microsoft
---
2020-03-02T20:16:48.5963412Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-02T20:16:48.5970906Z ##[command]git config gc.auto 0
2020-03-02T20:16:48.5995786Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-02T20:16:48.6004214Z ##[command]git config --get-all http.proxy
2020-03-02T20:16:48.6020234Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69609/merge:refs/remotes/pull/69609/merge

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 @TimNN. (Feature Requests)

src/libcore/alloc.rs Outdated Show resolved Hide resolved
src/libcore/alloc.rs Outdated Show resolved Hide resolved
src/libcore/alloc.rs Outdated Show resolved Hide resolved
src/libcore/alloc.rs Outdated Show resolved Hide resolved
src/libcore/alloc.rs Outdated Show resolved Hide resolved
@TimDiekmann
Copy link
Member Author

TimDiekmann commented Mar 2, 2020

I have applied your suggestions and squashed the commits.

@Amanieu
Copy link
Member

Amanieu commented Mar 2, 2020

@bors r+ rollup=always

@bors
Copy link
Contributor

bors commented Mar 2, 2020

📌 Commit d8e3557 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 Mar 2, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 3, 2020
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
bors added a commit that referenced this pull request Mar 3, 2020
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
bors added a commit that referenced this pull request Mar 3, 2020
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
@bors bors merged commit 4699b29 into rust-lang:master Mar 3, 2020
@TimDiekmann TimDiekmann deleted the excess branch March 5, 2020 00:28
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.

Remove usable_size APIs
4 participants