about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-08-09Make `slice::transmute*` privateTobias Bucher-1/+0
2015-08-09Replace many uses of `mem::transmute` with more specific functionsTobias Bucher-13/+26
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
2015-08-06Auto merge of #27545 - apasel422:btree-range, r=Gankrobors-6/+22
This permits collections with `String` keys to be ranged over with `&str` bounds. The `K` defaults for `Min` and `Max` permit the default type parameter fallback to work with things like ```rust use std::collections::{BTreeSet, Bound}; let set = BTreeSet::<String>::new(); set.range(Bound::Included("a"), Bound::Unbounded); ``` Without the defaults, the type of the maximum bound would be unconstrained. r? @Gankro
2015-08-05Fully generalize `BTree{Map, Set}` range iteratorsAndrew Paseltiner-6/+22
This permits collections with `String` keys to be ranged over with `&str` bounds. The `K` defaults for `Min` and `Max` permit the default type parameter fallback to work with things like ```rust use std::collections::{BTreeSet, Bound}; let set = BTreeSet::<String>::new(); set.range(Bound::Included("a"), Bound::Unbounded); ``` Without the defaults, the type of the maximum bound would be unconstrained.
2015-08-05Make note of Hash in Borrow's docsSteve Klabnik-0/+3
This should be a bit more prominent. Fixes #27109
2015-08-03syntax: Implement #![no_core]Alex Crichton-16/+28
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-30Auto merge of #26734 - Gankro:deprecate-vecmap, r=alexcrichtonbors-2/+7
VecMap doesn't really fit with the current standard library's strategy (small!). I've mirrored the code to https://github.com/contain-rs/vec-map but @GBGamer has already claimed the name on crates.io a couple months ago for the same purpose. It hasn't been updated since, though. CC @rust-lang/libs
2015-07-29deprecate vecmapAlexis Beingessner-2/+7
2015-07-30Rollup merge of #27352 - nagisa:illegal-to-invalid-docs, r=steveklabnikManish Goregaokar-9/+11
r? @steveklabnik
2015-07-29Auto merge of #27380 - steveklabnik:rollup, r=steveklabnikbors-143/+273
- Successful merges: #27102, #27286, #27313, #27325, #27326, #27327, #27341, #27342, #27343, #27345, #27350, #27355, #27374, #27375, #27379 - Failed merges:
2015-07-29Rollup merge of #27375 - niconii:vec-docs, r=GankroSteve Klabnik-1/+8
Noticed that syntax like `vec![0; 5]` is never mentioned in `Vec<T>`'s docs, nor used in any of its methods' docs, so I figured I should add a mention of it. Also noticed `vec!(1, 2)` being used in one spot while I was at it, so I fixed that as well for consistency's sake. r? @steveklabnik
2015-07-29Rollup merge of #27326 - steveklabnik:doc_show_use, r=GankroSteve Klabnik-123/+242
In spirit with https://internals.rust-lang.org/t/should-we-keep-including-obvious-imports-in-code-examples/2217, show the feature flags we're using in examples. (also one instance of 'use')
2015-07-29Rollup merge of #27102 - tshepang:better-examples, r=aturonSteve Klabnik-19/+23
2015-07-28Make docs for Vec::push() use vec! with square bracketsNicolette Verlinden-1/+1
2015-07-28Mention vec![x; len] syntax in Vec docsNicolette Verlinden-0/+7
2015-07-28libcollections: Inline some performance-critical string functions; e.g.Patrick Walton-0/+17
`chars()`. This was showing up in Servo profiles.
2015-07-28Replace occurences of illegal in user facing docsSimonas Kazlauskas-9/+11
2015-07-28Auto merge of #26914 - alexcrichton:deprecate-easy, r=aturonbors-0/+15
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * box_heap * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-0/+15
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-27Show appropriate feature flags in docsSteve Klabnik-123/+242
2015-07-25Document Unicode complications in chars iteratorKornel Lesiński-47/+71
2015-07-22Auto merge of #27172 - alexcrichton:snapshots, r=brsonbors-10/+0
Enables bootstrapping a 32-bit MSVC host compiler! Closes #26602
2015-07-20std: Create separate docs for the primitivesBrian Anderson-36/+4
Having the primitive and module docs derived from the same source causes problems, primarily that they can't contain hyperlinks cross-referencing each other. This crates dedicated private modules in `std` to document the primitive types, then for all primitives that have a corresponding module, puts hyperlinks in moth the primitive docs and the module docs cross-linking each other. This should help clear up confusion when readers find themselves on the wrong page.
2015-07-20doc: Clean up primitive short descriptionsBrian Anderson-2/+2
This makes the primitive descriptions on the front page read properly as descriptions of types and not of the associated modules.
2015-07-20Register new snapshotsAlex Crichton-10/+0
These new snapshots contain the knowledge of how to build the new triples of 32-bit MSVC and 32-bit FreeBSD, both of which should soon start having nightlies/auto builders! This does not currently register bitrig/freebsd snapshots but I believe those will be retroactively added in the near future.
2015-07-19Auto merge of #27100 - tshepang:better-names, r=Gankrobors-38/+38
2015-07-19doc: use 'index' and 'value' in place of 'i' and 't'Tshepang Lekhonkhobe-38/+38
2015-07-18'Copies' => 'Clones' in Cow method docs.Nick Hamann-2/+2
It seems slightly more consistent to say 'Clones' here instead of 'Copies'. The docs for the `ToOwned` trait talk about cloning and not copying.
2015-07-17Auto merge of #26955 - Gankro:raw-vec, r=bluss,alexcrichtonbors-444/+175
Per the top level comment: A low-level utility for more ergonomically allocating, reallocating, and deallocating a a buffer of memory on the heap without having to worry about all the corner cases involved. This type is excellent for building your own data structures like Vec and VecDeque. In particular: * Produces heap::EMPTY on zero-sized types * Produces heap::EMPTY on zero-length allocations * Catches all overflows in capacity computations (promotes them to "capacity overflow" panics) * Guards against 32-bit systems allocating more than isize::MAX bytes * Guards against overflowing your length * Aborts on OOM * Avoids freeing heap::EMPTY * Contains a ptr::Unique and thus endows the user with all related benefits This type does not in anyway inspect the memory that it manages. When dropped it *will* free its memory, but it *won't* try to Drop its contents. It is up to the user of RawVec to handle the actual things *stored* inside of a RawVec. Note that a RawVec always forces its capacity to be usize::MAX for zero-sized types. This enables you to use capacity growing logic catch the overflows in your length that might occur with zero-sized types. However this means that you need to be careful when roundtripping this type with a `Box<[T]>`: `cap()` won't yield the len. However `with_capacity`, `shrink_to_fit`, and `from_box` will actually set RawVec's private capacity field. This allows zero-sized types to not be special-cased by consumers of this type. Edit: fixes #18726 and fixes #23842
2015-07-17doc: improve some VecDeque examplesTshepang Lekhonkhobe-19/+23
2015-07-18Rollup merge of #27095 - tshepang:space, r=alexcrichtonManish Goregaokar-1/+1
2015-07-17doc: add missing spaceTshepang Lekhonkhobe-1/+1
2015-07-17Add RawVec to unify raw Vecish codeAlexis Beingessner-444/+175
2015-07-17Update vec.rsWei-Ming Yang-0/+1
improve the 'Unsafety' section of `collections::vec::Vec::<T>::from_raw_parts`.
2015-07-13Auto merge of #26241 - SimonSapin:derefmut-for-string, r=alexcrichtonbors-1/+57
See https://github.com/rust-lang/rfcs/issues/1157
2015-07-13Fix tests for changes in #26241.Simon Sapin-1/+1
2015-07-13Mark some new things as unstable.Simon Sapin-1/+3
2015-07-13Add str::split_at_mutSimon Sapin-0/+6
2015-07-13Implement IndexMut for String and str.Simon Sapin-0/+40
... matching the existing Index impls. There is no reason not to if String implement DerefMut. The code removed in `src/librustc/middle/effect.rs` was added in #9750 to prevent things like `s[0] = 0x80` where `s: String`, but I belive became unnecessary when the Index(Mut) traits were introduced.
2015-07-13Implement DerefMut for StringSimon Sapin-0/+8
`&mut str` is rarely useful, but it is for e.g. `AsciiExt::make_ascii_lowercase`.
2015-07-12Auto merge of #26957 - wesleywiser:rename_connect_to_join, r=alexcrichtonbors-2/+22
Fixes #26900
2015-07-12Auto merge of #26966 - nagisa:tail-init, r=alexcrichtonbors-4/+35
Fixes #26906
2015-07-11Add String::into_boxed_slice and Box<str>::into_stringJonathan Reem-21/+23
Implements merged RFC 1152. Closes #26697.
2015-07-12Implement RFC 1058Simonas Kazlauskas-4/+35
2015-07-11Auto merge of #26878 - Esption:master, r=pnkfelixbors-1/+1
I noticed in docs, specifically http://doc.rust-lang.org/std/primitive.u8.html#method.is_power_of_two, that it was like this, and it was apparently in multiple places too. Didn't change any occurrences through the cross-depo things. There's a lot in /src/llvm/ for instance, but I'm not confident on how to go about sending fixes for those, so this is just what's in the base rust depo. r? @steveklabnik
2015-07-11Fix feature nameWesley Wiser-1/+1
2015-07-11Fix version number on SliceConcatExt:joinWesley Wiser-1/+1
2015-07-10Rename SliceConcatExt::connect to join #26900Wesley Wiser-2/+22
2015-07-09Auto merge of #26904 - bluss:no-repeat, r=alexcrichtonbors-1/+1
In a followup to PR #26849, improve one more location for I/O where we can use `Vec::resize` to ensure better performance when zeroing buffers. Use the `vec![elt; n]` macro everywhere we can in the tree. It replaces `repeat(elt).take(n).collect()` which is more verbose, requires type hints, and right now produces worse code. `vec![]` is preferable for vector initialization. The `vec![]` replacement touches upon one I/O path too, Stdin::read for windows, and that should be a small improvement. r? @alexcrichton
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-1/+1
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)