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

Documentation for VecDeque.insert is unclear #37046

Closed
generalelectrix opened this issue Oct 9, 2016 · 1 comment
Closed

Documentation for VecDeque.insert is unclear #37046

generalelectrix opened this issue Oct 9, 2016 · 1 comment

Comments

@generalelectrix
Copy link

The documentation for VecDeque.insert describes implementation details of how it internally rearranges the data structure which make it unclear on what the actual behavior of the method call is:

"Inserts an element at index within the VecDeque. Whichever end is closer to the insertion point will be moved to make room, and all the affected elements will be moved to new positions.

Element at index 0 is the front of the queue."

The doc should clearly state that the element will be inserted at this index and the existing element at this index will be pushed towards the back of the deque. The current doc makes it sound like which direction the existing element will be pushed towards could be different depending on that implementation detail.

@frewsxcv
Copy link
Member

Opened a PR for this: #38581

frewsxcv added a commit to frewsxcv/rust that referenced this issue Dec 26, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jan 4, 2017
…aumeGomez

Clarify behavior of `VecDeque::insert`.

Fixes rust-lang#37046.
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jan 4, 2017
…aumeGomez

Clarify behavior of `VecDeque::insert`.

Fixes rust-lang#37046.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Jan 9, 2017
bors added a commit that referenced this issue Jan 9, 2017
Clarify behavior of `VecDeque::insert`.

Fixes #37046.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants