about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-02-17Rollup merge of #22311 - lfairy:consistent-fmt, r=alexcrichtonManish Goregaokar-4/+4
This brings it in line with its namesake in `std::io`. [breaking-change] r? @aturon
2015-02-17Rollup merge of #22394 - alexcrichton:vec-from-iter-comment, r=brsonManish Goregaokar-0/+11
Requested by Niko in #22200 (and is good to have anyway)
2015-02-17std: Add Vec::from_iter commentAlex Crichton-0/+11
Requested by Niko in #22200 (and is good to have anyway)
2015-02-17Rollup merge of #22313 - japaric:iter, r=aturonManish Goregaokar-0/+264
`IntoIterator` now has an extra associated item: ``` rust trait IntoIterator { type Item; type IntoIter: Iterator<Self=Self::Item>; } ``` This lets you bind the iterator \"`Item`\" directly when writing generic functions: ``` rust // hypothetical change, not included in this PR impl Extend<T> for Vec<T> { // you can now write fn extend<I>(&mut self, it: I) where I: IntoIterator<Item=T> { .. } // instead of fn extend<I: IntoIterator>(&mut self, it: I) where I::IntoIter: Iterator<Item=T> { .. } } ``` The downside is that now you have to write an extra associated type in your `IntoIterator` implementations: ``` diff impl<T> IntoIterator for Vec<T> { + type Item = T; type IntoIter = IntoIter<T>; fn into_iter(self) -> IntoIter<T> { .. } } ``` Because this breaks all downstream implementations of `IntoIterator`, this is a [breaking-change] --- r? @aturon
2015-02-17Rollup merge of #22253 - huonw:unstable-words, r=aturonManish Goregaokar-1/+2
It is not totally clear if we should just use whitespace, or if the full unicode word-breaking algorithm is more correct. If there is demand we can reconsider this decision (and consider the precise algorithm to use in detail). cc #15628.
2015-02-16Auto merge of #22367 - Manishearth:rollup, r=steveklabnikbors-3/+20
(still testing locally)
2015-02-15Fix rollup (remove slicing_syntax)Manish Goregaokar-2/+0
2015-02-15Rollup merge of #22247 - Gankro:dlist_split, r=alexcrichtonManish Goregaokar-1/+20
2015-02-15Auto merge of #22242 - Gankro:collect-ints, r=alexcrichtonbors-58/+58
2015-02-15Auto merge of #22058 - Gankro:all-the-impls, r=huonwbors-0/+151
Working on just knocking these out for all the collections so that there's something there.
2015-02-14naive RingBuf::append implAlexis-1/+50
2015-02-13allow DList to split_at . fixes #22244Alexis-1/+20
2015-02-13add an associated `Item` type to `IntoIterator`Jorge Aparicio-0/+264
2015-02-14Rename `fmt::Writer` to `fmt::Write`Chris Wong-4/+4
This brings it in line with its namesake in `std::io`. [breaking-change]
2015-02-13Auto merge of #22200 - alexcrichton:opt-vec-collect, r=huonwbors-1/+11
This PR is an optimization of the `FromIterator` implementation of `Vec` Benchmark: https://gist.github.com/alexcrichton/03d666159a28a80e7c70 Before: test macro_repeat1 ... bench: 57 ns/iter (+/- 1) test macro_repeat2 ... bench: 56 ns/iter (+/- 1) test map_clone1 ... bench: 828 ns/iter (+/- 13) test map_clone2 ... bench: 828 ns/iter (+/- 8) test repeat1 ... bench: 1104 ns/iter (+/- 10) test repeat2 ... bench: 1106 ns/iter (+/- 11) After: test macro_repeat1 ... bench: 75 ns/iter (+/- 21) test macro_repeat2 ... bench: 59 ns/iter (+/- 31) test map_clone1 ... bench: 34 ns/iter (+/- 22) test map_clone2 ... bench: 52 ns/iter (+/- 21) test repeat1 ... bench: 34 ns/iter (+/- 11) test repeat2 ... bench: 33 ns/iter (+/- 12) The idea behind this optimization is to avoid all bounds checks for space already allocated into the vector. This may involve running the iterator twice, but the first run of the iterator should be optimizable to a memcpy or memset if possible. The same treatment can in theory be applied to `Vec::extend` but the benchmarks for that currently get *worse* if the change is applied. This appears to be some LLVM optimizations going awry but it's seems prudent to land at least the `collect` portion beforehand.
2015-02-13more int and cloned cleanup in collectionsAlexis-58/+58
2015-02-13Unstabilise `words` for now.Huon Wilson-1/+2
It is not totally clear if we should just use whitespace, or if the full unicode word-breaking algorithm is more correct. If there is demand we can reconsider this decision (and consider the precise algorithm to use in detail). cc #15628.
2015-02-12std: Optimize Vec::from_iterAlex Crichton-1/+11
This PR is an optimization of the `FromIterator` implementation of `Vec` Benchmark: https://gist.github.com/alexcrichton/03d666159a28a80e7c70 Before: test macro_repeat1 ... bench: 57 ns/iter (+/- 1) test macro_repeat2 ... bench: 56 ns/iter (+/- 1) test map_clone1 ... bench: 828 ns/iter (+/- 13) test map_clone2 ... bench: 828 ns/iter (+/- 8) test repeat1 ... bench: 1104 ns/iter (+/- 10) test repeat2 ... bench: 1106 ns/iter (+/- 11) After: test macro_repeat1 ... bench: 75 ns/iter (+/- 21) test macro_repeat2 ... bench: 59 ns/iter (+/- 31) test map_clone1 ... bench: 34 ns/iter (+/- 22) test map_clone2 ... bench: 52 ns/iter (+/- 21) test repeat1 ... bench: 34 ns/iter (+/- 11) test repeat2 ... bench: 33 ns/iter (+/- 12) The idea behind this optimization is to avoid all bounds checks for space already allocated into the vector. This may involve running the iterator twice, but the first run of the iterator should be optimizable to a memcpy or memset if possible. The same treatment can in theory be applied to `Vec::extend` but the benchmarks for that currently get *worse* if the change is applied. This appears to be some LLVM optimizations going awry but it's seems prudent to land at least the `collect` portion beforehand.
2015-02-11rollup merge of #22166: dcrewi/iter-impls-for-windowsAlex Crichton-0/+12
- DoubleEndedIterator - ExactSizeIterator - RandomAccessIterator
2015-02-11Test fixes and rebase conflictsAlex Crichton-2/+4
2015-02-11implement missing iterator traits for slice::WindowsDavid Creswick-0/+12
- DoubleEndedIterator - ExactSizeIterator - RandomAccessIterator
2015-02-11rollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flagAlex Crichton-1/+3
Conflicts: src/libsyntax/feature_gate.rs
2015-02-11rollup merge of #22151: Gankro/macro-benchAlex Crichton-223/+120
r? @alexcrichton
2015-02-11rollup merge of #22127: alexcrichton/stability-holesAlex Crichton-1/+1
There are a number of holes that the stability lint did not previously cover, including: * Types * Bounds on type parameters on functions and impls * Where clauses * Imports * Patterns (structs and enums) These holes have all been fixed by overriding the `visit_path` function on the AST visitor instead of a few specialized cases. This change also necessitated a few stability changes: * The `collections::fmt` module is now stable (it was already supposed to be). * The `thread_local::imp::Key` type is now stable (it was already supposed to be). * The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable. These are required via the `panic!` macro. * The `std::old_io::stdio::{println, println_args}` functions are now stable. These are required by the `print!` and `println!` macros. * The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to make bounds with these traits stable. Note that manual implementations of these traits are still gated by default, this stability only allows bounds such as `F: FnOnce()`. Closes #8962 Closes #16360 Closes #20327
2015-02-11rustc: Fix a number of stability lint holesAlex Crichton-1/+1
There are a number of holes that the stability lint did not previously cover, including: * Types * Bounds on type parameters on functions and impls * Where clauses * Imports * Patterns (structs and enums) These holes have all been fixed by overriding the `visit_path` function on the AST visitor instead of a few specialized cases. This change also necessitated a few stability changes: * The `collections::fmt` module is now stable (it was already supposed to be). * The `thread_local::imp::Key` type is now stable (it was already supposed to be). * The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable. These are required via the `panic!` macro. * The `std::old_io::stdio::{println, println_args}` functions are now stable. These are required by the `print!` and `println!` macros. * The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to make bounds with these traits stable. Note that manual implementations of these traits are still gated by default, this stability only allows bounds such as `F: FnOnce()`. Additionally, the compiler now has special logic to ignore its own generated `__test` module for the `--test` harness in terms of stability. Closes #8962 Closes #16360 Closes #20327 [breaking-change]
2015-02-11Auto merge of #21972 - pnkfelix:new-dtor-semantics-6, r=nikomatsakisbors-14/+20
This is a resurrection and heavy revision/expansion of a PR that pcwalton did to resolve #8861. The most relevant, user-visible semantic change is this: #[unsafe_destructor] is gone. Instead, if a type expression for some value has a destructor, then any lifetimes referenced within that type expression must strictly outlive the scope of the value. See discussion on https://github.com/rust-lang/rfcs/pull/769
2015-02-11Feature-gate the `#[unsafe_no_drop_flag]` attribute.Felix S. Klock II-1/+3
See RFC 320, "Non-zeroing dynamic drops." Fix #22173 [breaking-change]
2015-02-11Add core::marker::PhantomData.Felix S. Klock II-14/+20
Port `core::ptr::Unique` to have `PhantomData`. Add `PhantomData` to `TypedArena` and `Vec` as well. As a drive-by, switch `ptr::Unique` from a tuple-struct to a struct with fields.
2015-02-11Opt into new `box_patterns` feature gate in various crates.Felix S. Klock II-0/+1
Namely: `collections` (used in `dlist.rs`), `syntax`, `rustc`, `rustc_typeck`, `rustc_trans`, and `rustdoc`.
2015-02-10fix and macro-ify map benches, fixes #22134Alexis-223/+120
2015-02-10rollup merge of #22125: alexcrichton/into-iter-stabilityAlex Crichton-22/+22
* Remove type parameters from `IteratorExt::cloned` * Rename `IntoIterator::Iter` to `IntoIterator::IntoIter` * Mark `IntoIterator::into_iter` as stable (but not the trait, only the method).
2015-02-10rollup merge of #22067: Gankro/collections-testsAlex Crichton-1/+1
So many warnings
2015-02-10Auto merge of #21937 - alexcrichton:issue-21929, r=aturonbors-1/+1
These were forgotten reexports from #21718 Closes #21929
2015-02-09std: Rename IntoIterator::Iter to IntoIterAlex Crichton-22/+22
This is in preparation for stabilization of the `IntoIterator` trait. All implementations and references to `Iter` need to be renamed to `IntoIter`. [breaking-change]
2015-02-09Auto merge of #22059 - Gankro:vec-split, r=alexcrichtonbors-3/+9
2015-02-07add split_off to RingBufAlexis-0/+102
2015-02-07add missing features to libcollections testsAlexis-1/+1
2015-02-07minor fixes to Vec docs and bounds checkAlexis-3/+9
2015-02-07Make std::fmt a simple re-export from collectionsKeegan McAllister-9/+401
2015-02-07Feature-gate #![no_std]Keegan McAllister-0/+1
Fixes #21833. [breaking-change]
2015-02-07Don't use std:: paths in syntax extensions when compiling a #![no_std] crateKeegan McAllister-10/+84
Fixes #16803. Fixes #14342. Fixes half of #21827 -- slice syntax is still broken.
2015-02-06make `IndexMut` a super trait over `Index`Jorge Aparicio-12/+0
closes #21630
2015-02-07fix outdated docsAlexis-60/+60
Conflicts: src/libstd/collections/mod.rs
2015-02-06libcollections: unit test fixesManish Goregaokar-2/+4
2015-02-06remove int_uint feature from libcollectionsAlexis-12/+12
2015-02-06Rollup merge of #21926 - mzabaluev:raw-lifetime, r=alexcrichtonManish Goregaokar-0/+1
New functions, `slice::from_raw_parts` and `slice::from_raw_parts_mut`, are added to implement the lifetime convention as agreed in rust-lang/rfcs#556. The functions `slice::from_raw_buf` and `slice::from_raw_mut_buf` are left deprecated for the time being. Holding back on changing the signature of `std::ffi::c_str_to_bytes` as consensus in rust-lang/rfcs#592 is building to replace it with a composition of other functions. Contribution to #21923.
2015-02-06Rollup merge of #21969 - Gankro:collections-cleanup, r=alexcrichtonManish Goregaokar-1362/+1327
This is 99% burning ints to the ground, but I also got rid of useless annotations or made code more \"idiomatic\" as I went along. Mostly changes in tests.
2015-02-06Rollup merge of #21925 - sfackler:allow-missing-copy, r=alexcrichtonManish Goregaokar-1/+0
This was particularly helpful in the time just after OIBIT's implementation to make sure things that were supposed to be Copy continued to be, but it's now creates a lot of noise for types that intentionally don't want to be Copy. r? @alexcrichton
2015-02-06Rollup merge of #21951 - Gankro:entry, r=aturonManish Goregaokar-32/+17
This also removes two erroneous re-exports of the Entry variants, and so is incidentally a [breaking-change], though presumably no one should have been using those. r? @aturon
2015-02-06Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnikManish Goregaokar-1/+1
The spelling corrections were made in both documentation comments and regular comments.