VecDeque documentation for as_slices misleads newbies. #141217
Labels
A-collections
Area: `std::collections`
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Location
https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.as_slices
Summary
VecDeque
documentation for as_slices method includes misleading test. It does fewpush
'es and the asserts a particular shape of deque viaassert_eq!
.This may mislead people and make them believe there are some guarantees about what particular slices are used for a given deque.
Instead we should add a line that says that particular split of elements between slices is not guaranteed and replace example with something like this:
That way is would be clear that while content of two returned slices is guaranteed – but particular shape of split between them is not guaranteed.
The text was updated successfully, but these errors were encountered: