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

Create try_new function for ThinBox #110483

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Conversation

tleibert
Copy link
Contributor

@tleibert tleibert commented Apr 18, 2023

The allocator_api feature has proven very useful in my work in the FreeBSD kernel. I've found a few places where a ThinBox #92791 would be useful, but it must be able to be fallibly allocated for it to be used in the kernel.

This PR proposes a change to add such a constructor for ThinBox.

ACP: rust-lang/libs-team#213

@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thomcc (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 18, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@tleibert tleibert mentioned this pull request Apr 18, 2023
4 tasks
@tleibert
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 18, 2023
@clubby789
Copy link
Contributor

Changes to unstable APIs require an API Change Proposal, linked in the bot comment

@tleibert
Copy link
Contributor Author

tleibert commented Apr 19, 2023

API change proposal rust-lang/libs-team#213

@thomcc
Copy link
Member

thomcc commented Apr 19, 2023

r=me on the impl, but needs api r+

@thomcc thomcc added the S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. label May 5, 2023
@Dylan-DPC Dylan-DPC removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 22, 2023
@thomcc
Copy link
Member

thomcc commented Feb 1, 2024

I'm going to be away for a few months, so I'm rerolling my PRs so that folks don't have to wait for me. Sorry/thanks.

r? libs

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Feb 1, 2024
@rustbot rustbot assigned joshtriplett and unassigned thomcc Feb 1, 2024
@joshtriplett
Copy link
Member

Seems reasonable to me, and I'd approve it, except that there's an open ACP and I don't want to bypass that.

r? libs-api

@rustbot rustbot assigned dtolnay and unassigned joshtriplett Feb 11, 2024
/// #![feature(thin_box)]
/// use std::boxed::ThinBox;
///
/// let five = ThinBox::new(5);
Copy link
Member

Choose a reason for hiding this comment

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

This example needs to cover ThinBox::try_new, not ThinBox::new.

Comment on lines 70 to 73
}

#[unstable(feature = "thin_box", issue = "92791")]
impl<T> ThinBox<T> {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
#[unstable(feature = "thin_box", issue = "92791")]
impl<T> ThinBox<T> {

These impl blocks are identical. They should be combined into one block, otherwise rustdoc will render it as two different impl blocks.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 11, 2024
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thank you!

@dtolnay dtolnay removed T-libs Relevant to the library team, which will review and decide on the PR/issue. S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. labels Feb 11, 2024
@dtolnay
Copy link
Member

dtolnay commented Feb 11, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Feb 11, 2024

📌 Commit ea6944a has been approved by dtolnay

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#110483 (Create try_new function for ThinBox)
 - rust-lang#120740 (Make cmath.rs a single file)
 - rust-lang#120872 (hir: Refactor getters for HIR parents)
 - rust-lang#120880 (add note on comparing vtables / function pointers)
 - rust-lang#120885 (interpret/visitor: ensure we only see normalized types)
 - rust-lang#120888 (assert_unsafe_precondition cleanup)
 - rust-lang#120897 (Encode `coroutine_for_closure` for foreign crates)
 - rust-lang#120937 ([docs] Update armv6k-nintendo-3ds platform docs for outdated info)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 251a09e into rust-lang:master Feb 12, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2024
Rollup merge of rust-lang#110483 - tleibert:thin-box-try-new, r=dtolnay

Create try_new function for ThinBox

The `allocator_api` feature has proven very useful in my work in the FreeBSD kernel. I've found a few places where a `ThinBox` rust-lang#92791 would be useful, but it must be able to be fallibly allocated for it to be used in the kernel.

This PR proposes a change to add such a constructor for ThinBox.

ACP: rust-lang/libs-team#213
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 26, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#110483 (Create try_new function for ThinBox)
 - rust-lang#120740 (Make cmath.rs a single file)
 - rust-lang#120872 (hir: Refactor getters for HIR parents)
 - rust-lang#120880 (add note on comparing vtables / function pointers)
 - rust-lang#120885 (interpret/visitor: ensure we only see normalized types)
 - rust-lang#120888 (assert_unsafe_precondition cleanup)
 - rust-lang#120897 (Encode `coroutine_for_closure` for foreign crates)
 - rust-lang#120937 ([docs] Update armv6k-nintendo-3ds platform docs for outdated info)

r? `@ghost`
`@rustbot` modify labels: rollup
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-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants