summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-11-04std::error: fix stray doc commentAaron Turon-3/+0
2014-11-03rollup merge of #18578 : japaric/cloneAlex Crichton-2/+0
2014-11-03rollup merge of #18536 : bjz/strconvAlex Crichton-544/+276
2014-11-03std: Fix fallout of changing `#[deriving(Clone)]`Jorge Aparicio-2/+0
2014-11-03rollup merge of #18537 : japaric/no-secretAlex Crichton-0/+6
2014-11-03rollup merge of #18519 : Gankro/collect-smashAlex Crichton-41/+37
2014-11-03auto merge of #18468 : jakub-/rust/iter-repeat, r=alexcrichtonbors-1/+1
Implements a part of RFC 235. [breaking-change]
2014-11-04Deprecate {f32, f64}::from_str_hexBrendan Zabarauskas-80/+27
This is now covered by `FromStrRadix::from_str_radix`
2014-11-04Simplify float string conversion function furtherBrendan Zabarauskas-161/+115
We now have a really simple function signature: pub fn from_str_radix_float<T: Float>(src: &str, radix: uint) -> Option<T> By removing some of the arguments, we remove the possibility of some invalid states.
2014-11-04Clean up from_str_float and use iteratorsBrendan Zabarauskas-156/+125
2014-11-04Remove unnecessary features from strconvBrendan Zabarauskas-121/+33
2014-11-04Separate string->integer implementation in strconvBrendan Zabarauskas-181/+131
2014-11-03auto merge of #18463 : japaric/rust/bytes2, r=alexcrichtonbors-55/+32
- The `BytesContainer::container_into_owned_bytes` method has been removed - Methods that used to take `BytesContainer` implementors by value, now take them by reference. In particular, this breaks some uses of Path: ``` rust Path::new("foo") // Still works path.join(another_path) -> path.join(&another_path) ``` [breaking-change] --- Re: `container_into_owned_bytes`, I've removed it because - Nothing in the whole repository uses it - Takes `self` by value, which is incompatible with unsized types (`str`) The alternative to removing this method is to split `BytesContainer` into `BytesContainer for Sized?` and `SizedBytesContainer: BytesContainer + Sized`, where the second trait only contains the `container_into_owned_bytes` method. I tried this alternative [in another branch](https://github.com/japaric/rust/commits/bytes) and it works, but it seemed better not to create a new trait for an unused method. Re: Breakage of `Path` methods We could use the idea that @alexcrichton proposed in #18457 (add blanket `impl BytesContainer for &T where T: BytesContainer` + keep taking `T: BytesContainer` by value in `Path` methods) to avoid breaking any code. r? @aturon cc #16918
2014-11-02refactor libcollections as part of collection reformAlexis Beingessner-41/+37
* Moves multi-collection files into their own directory, and splits them into seperate files * Changes exports so that each collection has its own module * Adds underscores to public modules and filenames to match standard naming conventions (that is, treemap::{TreeMap, TreeSet} => tree_map::TreeMap, tree_set::TreeSet) * Renames PriorityQueue to BinaryHeap * Renames SmallIntMap to VecMap * Miscellanious fallout fixes [breaking-change]
2014-11-02Add Error impls to a few key error typesAaron Turon-0/+32
2014-11-02Add error module with Error and FromError traitsAaron Turon-4/+122
As per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md) Closes #17747 Note that the `error` module must live in `std` in order to refer to `String`. Note that, until multidispatch lands, the `FromError` trait cannot be usefully implemented outside of the blanket impl given here.
2014-11-02core: Replace secret formatting functions with UFCS versionsJorge Aparicio-0/+6
2014-11-01Remove unnecessary allocationsJorge Aparicio-1/+1
2014-11-01DSTify BytesContainerJorge Aparicio-54/+31
2014-11-01bubble up out-of-memory errors from liballocDaniel Micay-1/+2
This makes the low-level allocation API suitable for use cases where out-of-memory conditions need to be handled. Closes #18292 [breaking-change]
2014-11-01auto merge of #18474 : alexcrichton/rust/no-more-traits, r=aturonbors-157/+383
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-11-01collections: Remove all collections traitsAlex Crichton-157/+383
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-11-01auto merge of #18457 : japaric/rust/tocstr, r=alexcrichtonbors-24/+0
Methods that used to take `ToCStr` implementors by value, now take them by reference. In particular, this breaks some uses of `Command`: ``` rust Command::new("foo"); // Still works Command::new(path) -> Command::new(&path) cmd.arg(string) -> cmd.arg(&string) or cmd.arg(string.as_slice()) ``` [breaking-change] --- It may be sensible to remove `impl ToCstr for String` since: - We're getting `impl Deref<str> for String`, so `string.to_cstr()` would still work - `Command` methods would still be able to use `cmd.arg(string[..])` instead of `cmd.arg(&string)`. But, I'm leaving that up to the library stabilization process. r? @aturon cc #16918
2014-10-31DSTify ToCStrJorge Aparicio-24/+0
2014-10-31DSTify HashJorge Aparicio-14/+17
- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from: ``` hashmap.find_equiv(&"Hello"); hashmap.find_equiv(&&[0u8, 1, 2]); ``` to: ``` hashmap.find_equiv("Hello"); hashmap.find_equiv(&[0u8, 1, 2]); ``` - The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example: ``` impl Hasher<FnvState> for FnvHasher { fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } } ``` must be changed to: ``` impl Hasher<FnvState> for FnvHasher { fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } // ^^^^^^ } ``` [breaking-change]
2014-10-30Test fixes and rebase conflictsAlex Crichton-1/+2
2014-10-30rollup merge of #18445 : alexcrichton/index-mutAlex Crichton-25/+21
Conflicts: src/libcollections/vec.rs
2014-10-30rollup merge of #18398 : aturon/lint-conventions-2Alex Crichton-40/+40
Conflicts: src/libcollections/slice.rs src/libcore/failure.rs src/libsyntax/parse/token.rs src/test/debuginfo/basic-types-mut-globals.rs src/test/debuginfo/simple-struct.rs src/test/debuginfo/trait-pointers.rs
2014-10-30rollup merge of #18443 : alexcrichton/deref-vec-and-stringAlex Crichton-1/+2
2014-10-30Add a `repeat` function to the preludeJakub Bukaj-1/+1
Implements a part of RFC 235. [breaking-change]
2014-10-30rollup merge of #18397 : aochagavia/asciiAlex Crichton-2/+1
2014-10-30rollup merge of #18393 : aochagavia/preludeAlex Crichton-1/+1
2014-10-30collections: Enable IndexMut for some collectionsAlex Crichton-25/+21
This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424
2014-10-30auto merge of #18374 : steveklabnik/rust/gh18197, r=sfacklerbors-4/+3
Fixes #18197
2014-10-30Change extensions traits to blanket implsNick Cameron-17/+18
2014-10-30changes to testsNick Cameron-2/+5
2014-10-30changes to libsNick Cameron-14/+32
2014-10-29collections: impl Deref for Vec/StringAlex Crichton-1/+2
This commit adds the following impls: impl<T> Deref<[T]> for Vec<T> impl<T> DerefMut<[T]> for Vec<T> impl Deref<str> for String This commit also removes all duplicated inherent methods from vectors and strings as implementations will now silently call through to the slice implementation. Some breakage occurred at std and beneath due to inherent methods removed in favor of those in the slice traits and std doesn't use its own prelude, cc #18424
2014-10-30auto merge of #18359 : 1-more/rust/feature, r=alexcrichtonbors-13/+18
2014-10-29Rename fail! to panic!Steve Klabnik-239/+239
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Fix example for BufferedReaderSteve Klabnik-4/+3
Fixes #18197
2014-10-28Update code with new lint namesAaron Turon-40/+40
2014-10-28Remove unnecessary clone in ascii.rsAdolfo OchagavĂ­a-2/+1
2014-10-28Add ptr::RawMutPtr to preludeAdolfo OchagavĂ­a-1/+1
Closes https://github.com/rust-lang/rust/issues/18196
2014-10-28Fix the output of negative durationVladimir Smola-13/+18
Technically speaking, negative duration is not valid ISO 8601, but we need to print it anyway. If `d` is a positive duration with the output `xxxxxxx`, then the expected output of negative `-d` value is `-xxxxxxx`. I.e. the idea is to print negative durations as positive with a leading minus sign. Closes #18181.
2014-10-27DSTify [T]/str extension traitsJorge Aparicio-10/+11
This PR changes the signature of several methods from `foo(self, ...)` to `foo(&self, ...)`/`foo(&mut self, ...)`, but there is no breakage of the usage of these methods due to the autoref nature of `method.call()`s. This PR also removes the lifetime parameter from some traits (`Trait<'a>` -> `Trait`). These changes break any use of the extension traits for generic programming, but those traits are not meant to be used for generic programming in the first place. In the whole rust distribution there was only one misuse of a extension trait as a bound, which got corrected (the bound was unnecessary and got removed) as part of this PR. [breaking-change]
2014-10-27Test fixes and rebase conflicts from rollupAlex Crichton-6/+6
2014-10-27rollup merge of #18366 : aochagavia/asciiAlex Crichton-4/+19
2014-10-27rollup merge of #18332 : jbcrail/fix-commentsAlex Crichton-1/+1
2014-10-27rollup merge of #18329 : sfackler/memwriter-clearAlex Crichton-2/+7