about summary refs log tree commit diff
path: root/src/libcore/slice.rs
AgeCommit message (Collapse)AuthorLines
2014-10-07Rename slicing methodsNick Cameron-1/+62
2014-10-07Rename slice::SliceNick Cameron-4/+4
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-42/+33
2014-10-06Add example to doc for `slice::ImmutableSlice::binary_search`.Felix S. Klock II-2/+42
Fix #17817.
2014-10-02rollup merge of #16993 : dschatzberg/items-boundsAlex Crichton-2/+2
2014-10-02Revert "Use slice syntax instead of slice_to, etc."Aaron Turon-47/+89
This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7.
2014-10-02Revert "Remove the `_` suffix from slice methods."Aaron Turon-58/+69
This reverts commit df2f1fa7680a86ba228f004e7de731e91a1df1fe.
2014-10-02Revert "Put slicing syntax behind a feature gate."Aaron Turon-2/+2
This reverts commit 95cfc35607ccf5f02f02de56a35a9ef50fa23a82.
2014-10-02Revert "Review and rebasing changes"Aaron Turon-3/+5
This reverts commit 6e0611a48707a1f5d90aee32a02b2b15957ef25b.
2014-10-02Add lifetime bounds on Items and MutItems.Dan Schatzberg-2/+2
This also requires a fix for Vec's MoveItems. This resolves issue #16941
2014-10-02Review and rebasing changesNick Cameron-5/+3
2014-10-02Put slicing syntax behind a feature gate.Nick Cameron-2/+2
[breaking-change] If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02Remove the `_` suffix from slice methods.Nick Cameron-69/+58
Deprecates slicing methods from ImmutableSlice/MutableSlice in favour of slicing syntax or the methods in Slice/SliceMut. Closes #17273.
2014-10-02Use slice syntax instead of slice_to, etc.Nick Cameron-89/+47
2014-09-25Fallout from deprecationAaron Turon-0/+1
2014-09-25Stabilize mutable slice APIAaron Turon-239/+266
This commit is another in the series of vector slice API stabilization. The focus here is the *mutable* slice API. Largely, this API inherits the stability attributes [previously assigned](https://github.com/rust-lang/rust/pull/16332) to the analogous methods on immutable slides. It also adds comments to a few `unstable` attributes that were previously missing them. In addition, the commit adds several `_mut` variants of APIs that were missing: - `init_mut` - `head_mut` - `tail_mut` - `splitn_mut` - `rsplitn_mut` Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory` -- were deprecated in favor of working through `as_mut_ptr`, to simplify the API surface. Due to deprecations, this is a: [breaking-change]
2014-09-22Fix deprecation warnings in check-docs.Victor Berger-2/+2
Fallout of closing #17185.
2014-09-19Implement slicing syntax.Nick Cameron-0/+58
`expr[]`, `expr[expr..]`, `expr[..expr]`,`expr[expr..expr]` Uses the Slice and SliceMut traits. Allows ... as well as .. in range patterns.
2014-09-16Fallout from renamingAaron Turon-19/+19
2014-09-16Align with _mut conventionsAaron Turon-18/+71
As per [RFC 52](https://github.com/rust-lang/rfcs/blob/master/active/0052-ownership-variants.md), use `_mut` suffixes to mark mutable variants, and `into_iter` for moving iterators. [breaking-change]
2014-09-05Optimize Slice::reverseBrian Anderson-1/+6
This makes the completely safe implementation of fannkuchredux perform the same as C++. Yay, Rust.
2014-09-01auto merge of #16897 : japaric/rust/mut-slice-collection, r=alexcrichtonbors-0/+9
2014-08-31&mut [T] now implements Collection. Fixes #16896Jorge Aparicio-0/+9
2014-08-30rollup merge of #16842 : zsiciarz/masterAlex Crichton-5/+5
2014-08-30rollup merge of #16835 : michaelsproul/doc-slice-failureAlex Crichton-28/+33
2014-08-29Register new snapshotsAlex Crichton-59/+0
2014-08-29Updated mut_chunks doc comment to match argument name.Zbigniew Siciarz-5/+5
2014-08-29doc: Clarify slice failure conditions.Michael Sproul-28/+33
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-3/+58
2014-08-26Rebasing changesNick Cameron-0/+21
2014-08-26DST coercions and DST structsNick Cameron-1/+0
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-1/+1
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-08-13Address some review feedbackBrian Anderson-14/+12
2014-08-13core: Put stability attributes all over the slice moduleBrian Anderson-0/+72
Much of this is as discussed[1]. Many things are marked [1]: https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-06.md
2014-08-13core: Add binary_search and binary_search_elem methods to slices.Brian Anderson-0/+92
These are like the existing bsearch methods but if the search fails, it returns the next insertion point. The new `binary_search` returns a `BinarySearchResult` that is either `Found` or `NotFound`. For convenience, the `found` and `not_found` methods convert to `Option`, ala `Result`. Deprecate bsearch and bsearch_elem.
2014-08-13core: Rename ImmutableEqSlice to ImmutablePartialEqSliceBrian Anderson-2/+2
This is in the prelude and won't break much code. [breaking-change]
2014-08-13core: Rename MutableCloneableSlice::copy_from to clone_from_sliceBrian Anderson-2/+8
Deprecate the previous.
2014-08-13core: Deprecate ImmutableSlice::tailn and initnBrian Anderson-0/+4
These are equivalent to slice_from and slice_to.
2014-08-13core: Rename ImmutableSlice::unsafe_ref to unsafe_getBrian Anderson-0/+12
Deprecate the previous.
2014-08-13std: Rename slice::Vector to SliceBrian Anderson-12/+14
This required some contortions because importing both raw::Slice and slice::Slice makes rustc crash. Since `Slice` is in the prelude, this renaming is unlikely to casue breakage. [breaking-change]
2014-08-13std: Rename various slice traits for consistencyBrian Anderson-12/+12
ImmutableVector -> ImmutableSlice ImmutableEqVector -> ImmutableEqSlice ImmutableOrdVector -> ImmutableOrdSlice MutableVector -> MutableSlice MutableVectorAllocating -> MutableSliceAllocating MutableCloneableVector -> MutableCloneableSlice MutableOrdVector -> MutableOrdSlice These are all in the prelude so most code will not break. [breaking-change]
2014-08-01Add a split_at method to slice::ImmutableVectornham-4/+17
This method is similar to the mut_split_at method of slice::MutableVector.
2014-07-05libcore: Fix Items iterator for zero sized types.Luqman Aden-12/+24
2014-06-30core: Remove the unnecessary 'traits' module from 'slice'Brian Anderson-49/+39
This is only breaking for code that references the empty `slice::traits` module. [breaking-change]
2014-06-30core: Reorganize slice module.Brian Anderson-458/+514
This is just moving things around so they are defined in a logical order.
2014-06-29Implement RFC#28: Add PartialOrd::partial_cmpSteven Fackler-0/+6
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. RFC: 0028-partial-cmp
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-4/+0
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.
2014-06-28Rename all raw pointers as necessaryAlex Crichton-14/+14
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-13/+13
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-13added get_mut() for [T]bachm-0/+8