about summary refs log tree commit diff
path: root/src/liballoc/collections/vec_deque.rs
AgeCommit message (Collapse)AuthorLines
2020-04-23Fix doc link errorsTyler Ruckinger-1/+1
2020-04-22More diagnostic items for Clippy usagePhilipp Hansch-0/+1
This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types.
2020-04-17Rollup merge of #71167 - RalfJung:big-o, r=shepmasterDylan DPC-3/+3
big-O notation: parenthesis for function calls, explicit multiplication I saw `O(n m log n)` in the docs and found that really hard to parse. In particular, I don't think we should use blank space as syntax for *both* multiplication and function calls, that is just confusing. This PR makes both multiplication and function calls explicit using Rust-like syntax. If you prefer, I can also leave one of them implicit, but I believe explicit is better here. While I was at it I also added backticks consistently.
2020-04-16Minor fixes to doc comments of 'VecDequeue'Youngsuk Kim-6/+6
1. Changed descriptions of `fn get` & `fn get_mut`. Since both of these functions are returning references, and not the owned value, I thought the doc comments could be fixed to be consistent with doc comments of `fn front` & `fn front_mut`. 2. Other changes are minor fixes or additions for clarification. Thank you for taking a look :)
2020-04-15big-O notation: parenthesis, multiplication and backticksRalf Jung-3/+3
2020-04-08add `VecDeque::make_contiguous` tracking issueBastian Kauschke-1/+1
2020-04-04use ManuallyDrop instead of forget inside collectionsTrevor Spiteri-6/+5
This commit changes some usage of mem::forget into mem::ManuallyDrop in some Vec, VecDeque, BTreeMap and Box methods. Before the commit, the generated IR for some of the methods was longer, and even after optimization, some unwinding artifacts were still present.
2020-03-31Rollup merge of #69425 - lcnr:make_contiguous, r=AmanieuDylan DPC-52/+153
add fn make_contiguous to VecDeque Adds the following method to VecDeque: ```rust pub fn make_contiguous(&mut self) -> &mut [T]; ``` Taken from https://github.com/rust-lang/rust/pull/69400, after a suggestion by @CryZe https://github.com/rust-lang/rust/pull/69400#issuecomment-590216089 I am in favor of merging this instead of https://github.com/rust-lang/rust/pull/69400.
2020-03-31fix docsBastian Kauschke-1/+1
2020-03-31update `VecDeque::as_(mut)_slice` docsBastian Kauschke-4/+4
2020-03-24must_use on split_offKornel-0/+1
#70194
2020-03-22update `make_contiguous` docsBastian Kauschke-1/+3
Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
2020-03-22document invariant of `VecDeque::as_(mut)_slice`Bastian Kauschke-0/+6
2020-03-22add `fn make_contiguous` to VecDequeBastian Kauschke-52/+145
2020-03-06fix various typosMatthias Krüger-1/+1
2020-01-19Move VecDeque Drain iterator to new fileJonas Schievink-121/+5
2020-01-19Fix leak in VecDeque::drain when drop panicsJonas Schievink-34/+48
2020-01-19Fix `VecDeque::truncate` leak on drop panicJonas Schievink-1/+16
2019-12-26Remove redundant link textsMatthew Kraai-1/+1
2019-12-22Format the worldMark Rousskov-142/+108
2019-12-13Rollup merge of #67235 - jonas-schievink:vecdeque-leak, r=KodrAusMazdak Farrokhzad-1/+13
VecDeque: drop remaining items on destructor panic Closes https://github.com/rust-lang/rust/issues/67232
2019-12-12Add comment to `Dropper`Jonas Schievink-0/+2
2019-12-11VecDeque: drop remaining items on destructor panicJonas Schievink-1/+11
2019-11-13Match VecDeque::extend to Vec::extendCharles Gleason-1/+16
2019-10-29Use truncate(0) in VecDeque clearCharles Gleason-1/+1
2019-10-29Use ptr::drop_in_place in VecDeque truncateCharles Gleason-2/+25
2019-10-29Match docs for VecDeque truncate to Vec truncateCharles Gleason-1/+2
2019-10-22Apply clippy::needless_return suggestionsMateusz Mikuła-1/+1
2019-10-10Override nth for VecDeque Iter and IterMutCharles Gleason-0/+20
2019-10-10Implement Clone::clone_from for VecDequeCharles Gleason-2/+79
2019-08-22Fix formatting.Tomasz Różański-1/+1
2019-08-22Fix a typo.Tomasz Różański-1/+1
2019-08-18Auto merge of #63045 - Rosto75:master, r=jonas-schievinkbors-43/+43
Change the placement of two functions. Right now, the order is as follows: `pop_front()` `push_front()` `push_back()` `pop_back()` `swap_remove_back()` `swap_remove_front()` I believe it would be more natural, and easier to follow, if we place `pop_back()` right after the `pop_front()`, and `swap_remove_back()` after the `swap_remove_front()` like this: `pop_front()` `pop_back()` `push_front()` `push_back()` `swap_remove_front()` `swap_remove_back()` The rest of the documentation (at least in this module) adheres to the same logic, where the 'front' function always precedes its 'back' equivalent.
2019-08-16Rename CollectionAllocError to TryReserveErrorSimon Sapin-8/+8
2019-08-02liballoc: Unconfigure tests during normal buildVadim Petrochenkov-386/+3
Remove additional libcore-like restrictions from liballoc, turns out the testing works ok if the tests are a part of liballoc itself.
2019-07-28Use const generics for some VecDeque impls.Mazdak Farrokhzad-26/+14
2019-07-27Change the placement of two functions.Tomasz Różański-43/+43
Right now, the order is as follows: `pop_front()` `push_front()` `push_back()` `pop_back()` `swap_remove_back()` `swap_remove_front()` I believe it would be more natural, and easier to follow, if we place `pop_back()` right after the `pop_front()`, and `swap_remove_back()` after the `swap_remove_front()` like this: `pop_front()` `pop_back()` `push_front()` `push_back()` `swap_remove_front()` `swap_remove_back()` The rest of the documentation (at least in this module) adheres to the same logic, where the 'front' function always precedes its 'back' equivalent.
2019-07-25Auto merge of #60340 - mgeier:cap-vs-capacity, r=alexcrichtonbors-17/+17
Rename .cap() methods to .capacity() As mentioned in #60316, there are a few `.cap()` methods, which seem out-of-place because such methods are called `.capacity()` in the rest of the code. This PR renames them to `.capacity()` but leaves `RawVec::cap()` in there for backwards compatibility. I didn't try to mark the old version as "deprecated", because I guess this would cause too much noise.
2019-07-18Rollup merge of #61926 - scottmcm:vec-vecdeque, r=Mark-SimulacrumMark Rousskov-0/+6
Fix hyperlinks in From impls between Vec and VecDeque I'd been trying to link them, but apparently actually just added brackets: <https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#impl-From%3CVec%3CT%3E%3E> ~~This reverts commit 5168f5d220d0b30d322f254f51142931a9054056.~~ ~~(I'd previously tried to make relative links, but those failed linkcheck because the types are exported at different levels. So just skip the links -- they're already linked in the function signature anyway.)~~ This makes the links now work.
2019-07-03Fix the links in Vec(Deque)-from-Vec(Deque)Scott McMurray-0/+6
Ok, I can't use `std` in doc-links, only in doc-tests. Try 7...
2019-07-02When possible without changing semantics, implement Iterator::last in terms ↵Kyle Huey-0/+10
of DoubleEndedIterator::next_back for types in liballoc and libcore. Provided that the iterator has finite length and does not trigger user-provided code, this is safe. What follows is a full list of the DoubleEndedIterators in liballoc/libcore and whether this optimization is safe, and if not, why not. src/liballoc/boxed.rs Box: Pass through to avoid defeating optimization of the underlying DoubleIterator implementation. This has no correctness impact. src/liballoc/collections/binary_heap.rs Iter: Pass through to avoid defeating optimizations on slice::Iter IntoIter: Not safe, changes Drop order Drain: Not safe, changes Drop order src/liballoc/collections/btree/map.rs Iter: Safe to call next_back, invokes no user defined code. IterMut: ditto IntoIter: Not safe, changes Drop order Keys: Safe to call next_back, invokes no user defined code. Values: ditto ValuesMut: ditto Range: ditto RangeMut: ditto src/liballoc/collections/btree/set.rs Iter: Safe to call next_back, invokes no user defined code. IntoIter: Not safe, changes Drop order Range: Safe to call next_back, invokes no user defined code. src/liballoc/collections/linked_list.rs Iter: Safe to call next_back, invokes no user defined code. IterMut: ditto IntoIter: Not safe, changes Drop order src/liballoc/collections/vec_deque.rs Iter: Safe to call next_back, invokes no user defined code. IterMut: ditto IntoIter: Not safe, changes Drop order Drain: ditto src/liballoc/string.rs Drain: Safe because return type is a primitive (char) src/liballoc/vec.rs IntoIter: Not safe, changes Drop order Drain: ditto Splice: ditto src/libcore/ascii.rs EscapeDefault: Safe because return type is a primitive (u8) src/libcore/iter/adapters/chain.rs Chain: Not safe, invokes user defined code (Iterator impl) src/libcore/iter/adapters/flatten.rs FlatMap: Not safe, invokes user defined code (Iterator impl) Flatten: ditto FlattenCompat: ditto src/libcore/iter/adapters/mod.rs Rev: Not safe, invokes user defined code (Iterator impl) Copied: ditto Cloned: Not safe, invokes user defined code (Iterator impl and T::clone) Map: Not safe, invokes user defined code (Iterator impl + closure) Filter: ditto FilterMap: ditto Enumerate: Not safe, invokes user defined code (Iterator impl) Skip: ditto Fuse: ditto Inspect: ditto src/libcore/iter/adapters/zip.rs Zip: Not safe, invokes user defined code (Iterator impl) src/libcore/iter/range.rs ops::Range: Not safe, changes Drop order, but ALREADY HAS SPECIALIZATION ops::RangeInclusive: ditto src/libcore/iter/sources.rs Repeat: Not safe, calling last should iloop. Empty: No point, iterator is at most one item long. Once: ditto OnceWith: ditto src/libcore/option.rs Item: No point, iterator is at most one item long. Iter: ditto IterMut: ditto IntoIter: ditto src/libcore/result.rs Iter: No point, iterator is at most one item long IterMut: ditto IntoIter: ditto src/libcore/slice/mod.rs Split: Not safe, invokes user defined closure SplitMut: ditto RSplit: ditto RSplitMut: ditto Windows: Safe, already has specialization Chunks: ditto ChunksMut: ditto ChunksExact: ditto ChunksExactMut: ditto RChunks: ditto RChunksMut: ditto RChunksExact: ditto RChunksExactMut: ditto src/libcore/str/mod.rs Chars: Safe, already has specialization CharIndices: ditto Bytes: ditto Lines: Safe to call next_back, invokes no user defined code. LinesAny: Deprecated Everything that is generic over P: Pattern: Not safe because Pattern invokes user defined code. SplitWhitespace: Safe to call next_back, invokes no user defined code. SplitAsciiWhitespace: ditto
2019-06-11Remove the questionably-useful exampleScott McMurray-22/+0
2019-06-08Add hyperlinks to Vec and VecDequeScott McMurray-2/+2
Let's try the auto-linking instead, since the relative ones don't work.
2019-06-08Apply suggestions from code reviewscottmcm-1/+1
Co-Authored-By: Joe ST <joe@fbstj.net>
2019-06-08Put the docs on the methods instead of the implsScott McMurray-53/+53
Since simulacrum suggested (on Discord) they're better there.
2019-06-08Apply suggestions from code reviewscottmcm-10/+10
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-06-08Add some Vec <-> VecDeque documentationScott McMurray-0/+53
These are more than just `.into_iter().collect()`, so talk about some of their nuances.
2019-05-19Rollup merge of #60678 - DutchGhost:master, r=scottmcmMazdak Farrokhzad-6/+2
Stabilize vecdeque_rotate This PR stabilizes the vecdeque_rotate feature. r? @scottmcm Closes https://github.com/rust-lang/rust/issues/56686
2019-05-10Add examples of ordered retainJosh Stone-0/+14
2019-05-09supposed to be 1.36.0Dodo-2/+2