Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for Vec::remove_item #40062
Comments
alexcrichton
added
B-unstable
T-libs
labels
Feb 23, 2017
This comment has been minimized.
This comment has been minimized.
|
PR moved to #40325 due to reasons |
This comment has been minimized.
This comment has been minimized.
|
Comments from original thread:
|
This comment has been minimized.
This comment has been minimized.
|
@clarcharr for |
This comment has been minimized.
This comment has been minimized.
|
@madseagames I meant specifically a method that searches for the item from the end of the vec instead of the beginning |
This comment has been minimized.
This comment has been minimized.
|
What do you think about adding |
This comment has been minimized.
This comment has been minimized.
|
I like |
This comment has been minimized.
This comment has been minimized.
MarkSwanson
commented
Jun 3, 2017
|
It would be nice if this was more generic. we really want the remove_item "item: &T" to be "something that we can compare equality with the type in the container". This would let remove_item() walk the T items, compare equality, and remove if equal. |
This comment has been minimized.
This comment has been minimized.
|
Seems reasonable to change the signature to |
Mark-Simulacrum
added
the
C-tracking-issue
label
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
|
Reviewing the naming used in method names and the docs, it would seem that iterators yield items while vecs contain elements. Considering that we insert elements then we should also remove elements and the method should be called fn remove_by<F: FnMut(&T) -> bool>(&mut self, f: F) |
This comment has been minimized.
This comment has been minimized.
zbraniecki
commented
Jan 29, 2018
|
Any plan to stabilize this? |
This comment has been minimized.
This comment has been minimized.
|
This has been in nightly for a year with no issue reported on the method itself. There are proposals for additional methods, but that shouldn’t block this one. Please submit separate PRs or RFCs. @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 17, 2018
•
|
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and none object), 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
added
the
proposed-final-comment-period
label
Mar 17, 2018
This comment has been minimized.
This comment has been minimized.
|
Are we switching to a |
This comment has been minimized.
This comment has been minimized.
|
Oops, sorry I missed that. Yes, let’s. |
This comment has been minimized.
This comment has been minimized.
|
Again here, as a maintainer of collections that offer the Vec and VecDeque APIs I'd like at least a summary comment explaining what this method does, why this design was followed, alternatives, and addressing the issues mentioned here that have received zero replies:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Not an issue with the method per se, but it may need to be very clearly documented that the reference is not supposed to be to an item that is in the Users coming from the C world of pointers but no proper equality comparison, may be confused by this method, e.g. https://users.rust-lang.org/t/difficult-borrowing-situation/16794 The |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin as the proposer for FCP, do you have thoughts on @gnzlbg's concern? |
Centril
added
the
disposition-merge
label
May 24, 2018
This comment has been minimized.
This comment has been minimized.
|
My thinking is that the |
This comment has been minimized.
This comment has been minimized.
|
cc @SimonSapin re. #40062 (comment) |
This comment has been minimized.
This comment has been minimized.
|
I don’t have a strong desire for this particular feature myself, I proposed FCP as an effort to reduce the number of features in "unstable limbo". That said: Regarding
|
This comment has been minimized.
This comment has been minimized.
|
I notice two things:
I think we should not stabilize this just because it exists, but instead someone should come up with a well justified explanation of exactly what the best "find and remove" set of methods of vec-likes would be. |
This comment has been minimized.
This comment has been minimized.
|
Good points.
|
This comment has been minimized.
This comment has been minimized.
|
@rfcbot resolve rationale-and-vecdeque I don't want to personally be on the hook for blocking this any more |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Feb 20, 2019
|
|
rfcbot
added
final-comment-period
and removed
proposed-final-comment-period
labels
Feb 20, 2019
rfcbot
added
the
finished-final-comment-period
label
Mar 2, 2019
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 2, 2019
|
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. The RFC will be merged soon. |
rfcbot
removed
the
final-comment-period
label
Mar 2, 2019
This comment has been minimized.
This comment has been minimized.
|
I still think this should be called |
This comment has been minimized.
This comment has been minimized.
|
My problem with that name is that it only removes the first matching item, not all that are |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/libs Can someone clarify what the status of this is wrt. the conversation above? |
This comment has been minimized.
This comment has been minimized.
Boiethios
commented
Apr 4, 2019
An example: I'm writing a proc macro attribute, and amongst the tokens, I expect other attribute to be there. This would be useful to add: if let Some(attr) = attrs.remove_item(|item| attr.path.is_ident("foo")) {
// Handle the `foo` attribute case...
} |
This comment has been minimized.
This comment has been minimized.
|
@Boiethios Until we sort this out, you can use |
madseagames commentedFeb 23, 2017
•
edited by SimonSapin
Implemented in #40325