about summary refs log tree commit diff
path: root/src/libcore/slice.rs
AgeCommit message (Collapse)AuthorLines
2015-03-26Register new snapshotsAlex Crichton-185/+0
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+1
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23601: nikomatsakis/by-value-indexAlex Crichton-0/+201
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`. r? @japaric cc @aturon @Gankro
2015-03-23Add generic conversion traitsAaron Turon-0/+5
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+1
2015-03-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-0/+201
references. For collections whose keys are integers, we take both references and by-value.
2015-03-18Register new snapshotsAlex Crichton-2/+0
2015-03-17Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiynManish Goregaokar-2/+2
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-16impl<T> *const T, impl<T> *mut TJorge Aparicio-0/+1
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-2/+2
2015-03-13slice::from_raw_parts is preferred over transmuting a fresh raw::SliceOliver Schneider-14/+27
2015-03-12Rollup merge of #23263 - alexcrichton:stabilize-from-raw-parts, r=brsonManish Goregaokar-2/+2
These new APIs have had some time to bake now, and no pressing issues have come up so they should be ok for stabilizing. Specifically, these two APIs were stabilized: * `slice::from_raw_parts` * `slice::from_raw_parts_mut`
2015-03-11Example -> ExamplesSteve Klabnik-2/+2
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-10std: Stabilize slice::from_raw_partsAlex Crichton-2/+2
These new APIs have had some time to bake now, and no pressing issues have come up so they should be ok for stabilizing. Specifically, these two APIs were stabilized: * `slice::from_raw_parts` * `slice::from_raw_parts_mut`
2015-03-03Rollup merge of #22988 - dcrewi:slice-swap-inline, r=alexcrichtonManish Goregaokar-0/+1
2015-03-02Slice::swap should be inlineableDavid Creswick-0/+1
2015-03-02Manual Clone for Windows/Chunks.Huon Wilson-2/+22
`#[derive(Clone)]` unnecessarily requires the element type to also be `Clone`.
2015-02-28Auto merge of #22669 - dotdash:fast_slice_iter, r=huonwbors-0/+3
This adds the assume() calls back that got lost when rebasing #21886.
2015-02-26Send/Sync audit for libcollectionsEdward Wang-1/+6
In the process, also replaces a raw mutable pointers with Unique to spell out the ownership semantics. cc #22709
2015-02-24std: Stabilize some `ptr` functionsAlex Crichton-4/+4
Specifically, the following actions were taken: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. * All type parameters now are `T: ?Sized` wherever possible and new clauses were added to the `offset` functions to require that the type is sized. [breaking-change]
2015-02-22Eliminate more excessive null-checks from slice iteratorsBjörn Steinbrink-0/+3
This adds the assume() calls back that got lost when rebasing #21886.
2015-02-20Refactored code into Searcher traits with naive implementationsMarvin Löbel-0/+4
Made the family of Split iterators use the Pattern API Renamed the Matcher traits into Searcher
2015-02-18Fallout: Port slice to use `PhantomData` instead of `ContravariantLifetime`Niko Matsakis-7/+7
2015-02-17Register new snapshotsAlex Crichton-22/+0
2015-02-17std: Stabilize the IntoIterator traitAlex Crichton-0/+2
Now that the necessary associated types exist for the `IntoIterator` trait this commit stabilizes the trait as-is as well as all existing implementations.
2015-02-17Rollup merge of #22313 - japaric:iter, r=aturonManish Goregaokar-0/+24
`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-14core::slice: uint -> usize, int -> isizeBrian Anderson-117/+117
2015-02-13add an associated `Item` type to `IntoIterator`Jorge Aparicio-0/+24
2015-02-11More test fixes and rebase conflictsAlex Crichton-1/+0
2015-02-11implement missing iterator traits for slice::WindowsDavid Creswick-2/+36
- DoubleEndedIterator - ExactSizeIterator - RandomAccessIterator
2015-02-09std: Rename IntoIterator::Iter to IntoIterAlex Crichton-2/+2
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-06make `IndexMut` a super trait over `Index`Jorge Aparicio-10/+0
closes #21630
2015-02-05Replace usage of slice::from_raw_buf with slice::from_raw_partsMikhail Zabaluev-4/+52
New functions, slice::from_raw_parts and slice::from_raw_parts_mut, are added to implement the lifetime convention as agreed in RFC PR #556. The functions slice::from_raw_buf and slice::from_raw_mut_buf are left deprecated for the time being.
2015-02-02register snapshotsJorge Aparicio-13/+0
2015-01-30remove Copy impls from iteratorsJorge Aparicio-4/+1
2015-01-30core: add the `IntoIterator` traitJorge Aparicio-0/+16
2015-01-30Rename FullRange to RangeFullNick Cameron-14/+28
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-1/+1
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-4/+4
Conflicts: src/libcore/cmp.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/result.rs src/libcore/str/mod.rs src/librustc/lint/builtin.rs src/librustc/lint/context.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/poison.rs
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-54/+27
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
2015-01-25Moving away from deprecated i/u suffixes in libcoreAlfie John-4/+4
2015-01-23grandfathered -> rust1Brian Anderson-34/+34
2015-01-23Set unstable feature names appropriatelyBrian Anderson-32/+32
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else
2015-01-21Remove 'since' from unstable attributesBrian Anderson-32/+32
2015-01-21Tie stability attributes to feature gatesBrian Anderson-1/+0
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-66/+69
2015-01-21rollup merge of #21258: aturon/stab-3-indexAlex Crichton-50/+18
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
2015-01-21rollup merge of #21396: japaric/no-parens-in-rangeAlex Crichton-4/+4
Conflicts: src/libsyntax/parse/lexer/comments.rs
2015-01-21rollup merge of #21053: apasel422/exactAlex Crichton-0/+5
2015-01-21Deprecate slicing methods in favor of notationAaron Turon-50/+18
This commit deprecates `slice`, `slice_from`, `slice_to` and their mutable variants in favor of slice notation. The `as_slice` methods are left intact, for now. [breaking-change]