about summary refs log tree commit diff
path: root/library/alloc/src/vec/into_iter.rs
AgeCommit message (Collapse)AuthorLines
2022-04-28Add VecDeque::extend from vec::IntoIter and slice::Iter specializationsPaolo Barbolini-0/+5
2022-03-31Rollup merge of #95298 - ↵Dylan DPC-6/+9
jhorstmann:fix-double-drop-of-allocator-in-vec-into-iter, r=oli-obk Fix double drop of allocator in IntoIter impl of Vec Fixes #95269 The `drop` impl of `IntoIter` reconstructs a `RawVec` from `buf`, `cap` and `alloc`, when that `RawVec` is dropped it also drops the allocator. To avoid dropping the allocator twice we wrap it in `ManuallyDrop` in the `InttoIter` struct. Note this is my first contribution to the standard library, so I might be missing some details or a better way to solve this.
2022-03-29Make the stdlib largely conform to strict provenance.Aria Beingessner-1/+1
Some things like the unwinders and system APIs are not fully conformant, this only covers a lot of low-hanging fruit.
2022-03-25Use ManuallyDrop::take instead of into_innerJörn Horstmann-1/+1
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2022-03-25Fix double drop of allocator in IntoIter impl of VecJörn Horstmann-6/+9
2022-03-22rename internal helper trait AsIntoIter to AsVecIntoIterThe 8472-2/+2
2022-03-21add module-level documentation for vec's in-place iterationThe8472-0/+5
2022-03-21move AsIntoIter helper trait and mark it as unsafeThe8472-8/+4
2022-01-13Add Sync bound to allocator parameter in vec::IntoIterMichael Goulet-1/+1
2021-10-04Rollup merge of #89413 - matthewjasper:spec-marker-fix, r=nikomatsakisJubilee-3/+10
Correctly handle supertraits for min_specialization Supertraits of specialization markers could circumvent checks for min_specialization. Elaborating predicates prevents this. r? ````@nikomatsakis````
2021-09-30Fix standard library for min_specialization changesMatthew Jasper-3/+10
2021-09-30fix issues pointed out in reviewThe8472-10/+11
2021-09-30implement advance_(back_)_by on more iteratorsThe8472-0/+45
2021-09-22PR fixupAman Arora-1/+1
2021-09-212229: Annotate stdlib with insignficant dtorsAman Arora-0/+1
2021-07-28Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmtFrank Steffahn-1/+3
2021-07-28Add back TrustedRandomAccess-specialization for Vec, but only without coercionsFrank Steffahn-1/+33
2021-07-28Remove unsound TrustedRandomAccess implementationsFrank Steffahn-30/+1
Removes the implementations that depend on the user-definable trait `Copy`.
2021-06-16Add doc(hidden) to all __iterator_get_uncheckedJacob Hoffman-Andrews-0/+1
This method on the Iterator trait is doc(hidden), and about half of implementations were doc(hidden). This adds the attribute to the remaining implementations.
2021-05-16mark internal inplace_iteration traits as hiddenThe8472-0/+2
2021-05-05alloc: Add unstable Cfg feature `no-global_oom_handling`John Ericson-0/+2
For certain sorts of systems, programming, it's deemed essential that all allocation failures be explicitly handled where they occur. For example, see Linus Torvald's opinion in [1]. Merely not calling global panic handlers, or always `try_reserving` first (for vectors), is not deemed good enough, because the mere presence of the global OOM handlers is burdens static analysis. One option for these projects to use rust would just be to skip `alloc`, rolling their own allocation abstractions. But this would, in my opinion be a real shame. `alloc` has a few `try_*` methods already, and we could easily have more. Features like custom allocator support also demonstrate and existing to support diverse use-cases with the same abstractions. A natural way to add such a feature flag would a Cargo feature, but there are currently uncertainties around how std library crate's Cargo features may or not be stable, so to avoid any risk of stabilizing by mistake we are going with a more low-level "raw cfg" token, which cannot be interacted with via Cargo alone. Note also that since there is no notion of "default cfg tokens" outside of Cargo features, we have to invert the condition from `global_oom_handling` to to `not(no_global_oom_handling)`. This breaks the monotonicity that would be important for a Cargo feature (i.e. turning on more features should never break compatibility), but it doesn't matter for raw cfg tokens which are not intended to be "constraint solved" by Cargo or anything else. To support this use-case we create a new feature, "global-oom-handling", on by default, and put the global OOM handler infra and everything else it that depends on it behind it. By default, nothing is changed, but users concerned about global handling can make sure it is disabled, and be confident that all OOM handling is local and explicit. For this first iteration, non-flat collections are outright disabled. `Vec` and `String` don't yet have `try_*` allocation methods, but are kept anyways since they can be oom-safely created "from parts", and we hope to add those `try_` methods in the future. [1]: https://lore.kernel.org/lkml/CAHk-=wh_sNLoz84AUUzuqXEsYH35u=8HV3vK-jbRbJ_B-JjGrg@mail.gmail.com/
2021-03-29fix double-drop in in-place collect specializationThe8472-9/+18
2021-02-15Turn may_have_side_effect into an associated constantTomasz Miąsko-3/+1
The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess` trait. It describes if obtaining an iterator element may have side effects. It is currently implemented as an associated function. Turn `may_have_side_effect` into an associated constant. This makes the value immediately available to the optimizer.
2020-12-30Fix rustdoc link in vec/into_iter.rs.Mara Bos-2/+2
2020-12-29docs: fixing referencesC-1/+1
2020-12-29style: applying Rust styleC-9/+7
2020-12-29refactor: moving AsIntoIter into into_iter.rsC-0/+15
2020-12-29refactor: moved IntoIter into into_iter.rsC-0/+270