-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rename push/pop_back
to push
/pop
, add to MutableSeq
#15611
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
Conversation
Hm, probably need to move around some docs here. |
@@ -63,7 +63,7 @@ | |||
#[doc(no_inline)] pub use clone::Clone; | |||
#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; | |||
#[doc(no_inline)] pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; | |||
#[doc(no_inline)] pub use collections::{Collection, Mutable, Map, MutableMap}; | |||
#[doc(no_inline)] pub use collections::{Collection, Mutable, Map, MutableMap, MutableSeq}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the Vim syntax file to include MutableSeq
?
Overall I'm not certain if we want these methods to be in a trait or not (yet another prelude trait), but I'm ok with as-is for now. Thinking about a question such as this would require more thought to the design of the collection traits in general. This is definitely a step forward, and I'm a fan of it. 👍 |
Oh yes I forgot to say, I'm generally in favor of this as well 👍 though I agree with @alexcrichton that at some point we do need to give some thought to the design of the collection traits and make sure that what we have is appropriate. |
I'm late to the party, but yes, this moves us in the right direction. We should consider adding One issue, though: I'm not sure this closes #10852, since that issue was at least partly about renaming |
@aturon Oh good point about |
I added a commit that makes |
Guh, if Vec implements Deque then we have to deal with the inconsistency between |
I'm not going to deal with that. There will be temporary redundancy. |
#15626 covers the |
To deprecate shift/unshift on Vec we should probably put Deque in the prelude. |
Added another commit that implements |
@brson As dcb mentioned on IRC a few minutes ago, implementing |
I suggest not implementing |
@kballard beat me to it :) |
Ok. I will just deprecate shift and unshift and not implement Deque. |
All comments addressed. |
#[link(name = "dl")] | ||
#[link(name = "m")] | ||
#[link(name = "stdc++")] | ||
extern {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have snuck in by accident.
I feel like r=me with the stray file removed. |
As in, I don't want to bikeshed the name of a trait at this time that is rarely spoken compared to the methods. A later PR can handle the collections traits as a whole. |
Implement for Vec, DList, RingBuf. Add MutableSeq to the prelude. Since the collections traits are in the prelude most consumers of these methods will continue to work without change. [breaking-change]
Use insert/remove instead.
This fixes naming conventions for `push`/`pop` from either end of a structure by partially implementing @erickt's suggestion from #10852 (comment), namely: * push/pop from the 'back' are called `push` and `pop`. * push/pop from the 'front' are called `push_front` and `pop_front`. * `push`/`pop` are declared on the `MutableSeq` trait. * Implement `MutableSeq` for `Vec`, `DList`, and `RingBuf`. * Add `MutableSeq` to the prelude. I did not make any further refactorings because there is some more extensive thought that needs to be put into the collections traits. This is an easy first step that should close #10852. I left the `push_back` and `pop_back` methods on `DList` and `RingBuf` deprecated. Because `MutableSeq` is in the prelude it shouldn't break many, but it is a breaking change.
Prefer stable paths over unstable ones in import path calculation Fixes rust-lang/rust-analyzer#15610
This fixes naming conventions for
push
/pop
from either end of a structure by partially implementing @erickt's suggestion from #10852 (comment), namely:push
andpop
.push_front
andpop_front
.push
/pop
are declared on theMutableSeq
trait.MutableSeq
forVec
,DList
, andRingBuf
.MutableSeq
to the prelude.I did not make any further refactorings because there is some more extensive thought that needs to be put into the collections traits. This is an easy first step that should close #10852.
I left the
push_back
andpop_back
methods onDList
andRingBuf
deprecated. BecauseMutableSeq
is in the prelude it shouldn't break many, but it is a breaking change.