-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Require allocator to be static for boxed Pin
-API
#79327
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Does this requirement also need to be on |
Box::pin_in
Pin
-API
Good point, I added the bound to some other places.
Do you want me reassign this PR to |
No, I can review, just wanted to ping. |
r=me with commits squashed. I tried to do a cursory check for other cases where this would be needed and didn't find anything, though it's no guarantee. It's a bit concerning that these bounds are necessary, in some sense, but I think we just need to be careful -- ultimately no old code should break. Maybe something to note on API guidelines or similar? |
785df47
to
7387f48
Compare
Done, but I don't have the permissions to r+ unless you
I'm not 100% sure neither, if all of them are necessary, but I agree, that staying conservative is the way to go here. Dropping the bound later is no problem.
This won't be the case as it only affects the allocator-parameter and that is unstable.
Hmm, what do you mean? Regarding the pin-API in general? |
Yes, as we add allocator parameters, it can be easy to think that it'll always be 'static. Noting somewhere that this is not true explicitly I think would be good. Not directly related to Pin, though. @bors r+ |
📌 Commit 7387f48 has been approved by |
I'll add a note to the |
I feel a bit concerned about this, as The most conservative option would be to get rid of pin_in and have all the other Pin APIs only implemented for |
Rollup of 11 pull requests Successful merges: - rust-lang#79327 (Require allocator to be static for boxed `Pin`-API) - rust-lang#79340 (Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`) - rust-lang#79363 (BTreeMap: try to enhance various comments) - rust-lang#79395 (Move ui if tests from top-level into `expr/if`) - rust-lang#79443 (Improve rustdoc JS tests error output) - rust-lang#79464 (Extend doc keyword feature by allowing any ident) - rust-lang#79484 (add enable-full-tools to freebsd builds to prevent occasional link er…) - rust-lang#79505 (Cleanup: shorter and faster code) - rust-lang#79514 (Add test for issue rust-lang#54121: order dependent trait bounds) - rust-lang#79516 (Remove unnecessary `mut` binding) - rust-lang#79528 (Fix a bootstrap comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
rust-lang#79327 added `'static` bounds to the allocator parameter for various `Box` + `Pin` APIs to ensure soundness. But it was a bit overzealous, some of the bounds aren't actually needed.
…r, r=Amanieu Add `A: 'static` bound for `Arc/Rc::pin_in` Analogous to rust-lang#79327 Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
…r, r=Amanieu Add `A: 'static` bound for `Arc/Rc::pin_in` Analogous to rust-lang#79327 Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
…, r=Amanieu Remove useless `'static` bounds on `Box` allocator rust-lang#79327 added `'static` bounds to the allocator parameter for various `Box` + `Pin` APIs to ensure soundness. But it was a bit overzealous, some of the bounds aren't actually needed.
… r=Amanieu Add `A: 'static` bound for `Arc/Rc::pin_in` Analogous to rust-lang#79327 Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
Add `A: 'static` bound for `Arc/Rc::pin_in` Analogous to rust-lang/rust#79327 Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
Add `A: 'static` bound for `Arc/Rc::pin_in` Analogous to rust-lang/rust#79327 Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
Add `A: 'static` bound for `Arc/Rc::pin_in` Analogous to rust-lang/rust#79327 Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
Allocators has to retain their validity until the instance and all of its clones are dropped. When pinning a value, it must live forever, thus, the allocator requires a
'static
lifetime for pinning a value. Example from reddit: