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

Tracking issue for Box::into_pin (feature box_into_pin) #62370

Closed
Nemo157 opened this issue Jul 4, 2019 · 8 comments · Fixed by #97397
Closed

Tracking issue for Box::into_pin (feature box_into_pin) #62370

Nemo157 opened this issue Jul 4, 2019 · 8 comments · Fixed by #97397
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Jul 4, 2019

This is a tracking issue for Box::into_pin implemented in #57313

impl<T: ?Sized> Box<T> {
    pub fn into_pin(boxed: Box<T>) -> Pin<Box<T>>;
}
@Centril Centril added B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 4, 2019
@Nemo157
Copy link
Member Author

Nemo157 commented Jul 4, 2019

I don't think this is really a useful feature to specialize in this way. Can't you just use the hyper fish operator to disambiguate?
@czipperz (#57313 (comment))

There are currently 2 unambiguous stable ways to convert a Box<T> into a Pin<Box<T>> without additional inference constraints

let foo: Box<T> = ...;
let bar = <Pin<Box<_>>>::from(foo);
let bar: Pin<Box<_>> = foo.into();

Also, at the moment let bar = Pin::from(foo); works because there is only one trait implementation that can satisfy that call, but because Pin and Box are #[fundamental] it's possible for an external library to add an additional From implementation that makes that ambiguous (playground).

In a lot of cases where you need to convert into a Pin<Box<_>> you're likely to have inference available to guide the .into() call as well, but not always.

@czipperz
Copy link
Contributor

czipperz commented Jul 8, 2019

Well there's also Box::pin(foo) right?

@czipperz
Copy link
Contributor

czipperz commented Jul 8, 2019

Mmh but that takes a T and wraps it into Pin<Box<T>>. I think with that context Box::into_pin makes a lot of sense.

@KodrAus KodrAus added the Libs-Tracked Libs issues that are tracked on the team's project board. label Jul 30, 2020
@joshtriplett
Copy link
Member

Shall we stabilize Box::into_pin?

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Dec 22, 2021

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Dec 22, 2021
@BurntSushi
Copy link
Member

Also, at the moment let bar = Pin::from(foo); works because there is only one trait implementation that can satisfy that call, but because Pin and Box are #[fundamental] it's possible for an external library to add an additional From implementation that makes that ambiguous (playground).

It seems like this is something that should be mentioned in the docs of into_pin, specifically as something that differentiates it from Pin::from.

@rfcbot
Copy link

rfcbot commented Jan 3, 2022

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jan 3, 2022
@rfcbot rfcbot added the finished-final-comment-period The final comment period is finished for this PR / Issue. label Jan 13, 2022
@rfcbot
Copy link

rfcbot commented Jan 13, 2022

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jan 13, 2022
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Jan 20, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 2, 2022
…=Mark-Simulacrum

Stabilize `box_into_pin`

FCP has been completed: rust-lang#62370 (comment)
Also, adds notes as per rust-lang#62370 (comment)
Closes rust-lang#62370
@bors bors closed this as completed in 9225f78 Jun 2, 2022
workingjubilee pushed a commit to tcdi/postgrestd that referenced this issue Sep 15, 2022
…ulacrum

Stabilize `box_into_pin`

FCP has been completed: rust-lang/rust#62370 (comment)
Also, adds notes as per rust-lang/rust#62370 (comment)
Closes #62370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants