-
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
Implement placement-in protocol for relevant data structures #30172
Comments
we might consider |
@nagisa |
@apasel422 added to the list. |
Since the LinkedList has been implemented one could use the PR as example when implementing the protocol for other collections. |
@nagisa this looks like something I'd like to take a swing at; would some initial code in a week (±a weekend) be ok? |
Sure!
|
@nagisa quick update: apart from an unexpected shortage of spare time, this is going well. I've mostly been reading/understanding Placer et alia & the LinkedList implmentation. I'm starting with the VecDeque given its broad similarity, but not a lot to show yet. |
Wanted for WebRender. |
Dear T-libs members. It has been a
Perhaps the boring, cold and silent cooldown period after Christmas could be a good time to ponder on whatever you think is the best and report after the vacation? I’d like to note that gaining experience with placement-in is literally blocking stabilisation of this feature and since nothing implements the placement-in stuff, nobody is using it, ergo not gaining experience. I feel like adding the placement-in impls, be it in an unstable form, is the easiest way to break this loop that’s putting this awesome feature to the cold hands of Ms. Banshee. |
@nagisa Thanks for the reminder! It looks like what happened here is that the libs team discussion was posted to the PR rather than the tracking issue. To recap:
But then it turned out we can't quite get the desired sweet syntax for (In terms of priority, placement continues to not be a high priority as far as I'm aware.) |
Implement placement-in protocol for `Vec` Follow-up of #32366 per comment at #30172 (comment), updating to latest rust, leaving @apasel422 as author and putting myself as committer. I've removed the implementation of `push` in terms of place to make this PR more conservative.
Implement placement-in protocol for `BinaryHeap` Related to #30172, and loosley based on #38551. At the moment, this PR is in a pretty rough state, but I wanted to get some feedback to see if I'm going in the right direction. I hope the Mentor label of #30172 is still applicable, even though it's a year old 😄
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `VecDeque` CC rust-lang#30172 r? @nagisa
Implement placement-in protocol for `HashMap` CC rust-lang#30172 r? @nagisa
API issue: reusing Vec's placer type allows violating memory safety (writing to the Vec without allocating space). See issue #44637 |
(Edited: This ended up in the wrong issue, transporting the comment over to the tracking issue for placement new.) |
I also wonder whether it is useful to implement placement-in protocol for many wrapper types beside collections, such as |
Looks like this is headed in the opposite direction now? rust-lang/rfcs#2387 |
Closing as per removal of placement features in #48333. |
We currently have the unstable new arrow syntax (
<-
) for placement-in in nightly with intention to see how people like the syntax/how ergonomic it is/etc. However, it is pretty hard to try the syntax out without having any useful/common data-structures implementing the placement-in protocol and thus it is pretty unlikely for us to collect much feedback on the syntax.The
Placer
,Place
andInPlace
traits should be implemented for following data structures as appropriate:&mut myvec <- value
; see this RFC regarding mutable reference) Implement placement-in protocol forVec
#32366mymap.entry(k) <- value
) Implement placement-in protocol forHashMap
#40390LinkedList
#31696&mut heap <- value
) Implement placement-in protocol forBinaryHeap
#39062front_place
andback_place
, likeLinkedList
) Implement placement-in protocol forVecDeque
#40389It should also be investigated how viable implementing placement protocol is for other
std::collections
collections and possibly implementing these as well.Since both placement protocol and placement-in syntax are unstable, there’s no stability hazard.
cc @pnkfelix.
I personally feel this issue has tons of potential to help people get acquainted with rust’s standard library (i.e. is in E-easy land) and would be willing to answer any questions (E-mentor) regarding implementation strategies on IRC or the issue itself.
The text was updated successfully, but these errors were encountered: