summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-11-18rollup merge of #19016: gkoz/use_util_copyJakub Bukaj-9/+1
This code is identical to io::util::copy()
2014-11-17Fix several typos in commentsjmu303-2/+2
liblog, libregex, librustc, libstd
2014-11-17Remove bogus Duration::span testAaron Turon-7/+0
2014-11-17Fallout from deprecationAaron Turon-4/+4
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17libstd: Deprecate _equiv methodsAaron Turon-123/+84
This commit deprecates the `_equiv` family of methods on `HashMap` and `HashSet` by instead generalizing the "normal" methods like `get` and `remove` to use the new `std::borrow` infrastructure. [breaking-change]
2014-11-17libcore: add borrow moduleAaron Turon-0/+1
Following [the collections reform RFC](https://github.com/rust-lang/rfcs/pull/235), this commit adds a new `borrow` module to libcore. The module contains traits for borrowing data (`BorrowFrom` and `BorrowFromMut`), generalized cloning (`ToOwned`), and a clone-on-write smartpointer (`Cow`).
2014-11-17Return proper errors with update_errGleb Kozyrev-1/+1
2014-11-17Remove duplicate code by using util::copy()Gleb Kozyrev-9/+1
2014-11-17Switch to purely namespaced enumsSteven Fackler-12/+64
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichtonbors-359/+359
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
2014-11-17Fix fallout from coercion removalNick Cameron-359/+359
2014-11-16fallout from deprecating find_copy and get_copyAlexis Beingessner-1/+1
2014-11-16Deprecate hashmap's find_copy and get_copy in favour of cloned and cloneAlexis Beingessner-25/+7
2014-11-16Fix doctestsJakub Bukaj-2/+2
2014-11-16Fix warningsJakub Bukaj-1/+1
2014-11-16rollup merge of #18985: alexcrichton/issue-18900Jakub Bukaj-24/+22
2014-11-16rollup merge of #18976: bjz/rfc369-numericsJakub Bukaj-727/+39
2014-11-16rollup merge of #18941: reem/better-task-poolJakub Bukaj-63/+167
2014-11-16auto merge of #18788 : ricky26/rust/master, r=aturonbors-12/+25
This moves chars() and lines() out of Buffer and into separate traits (CharsBuffer and LinesBuffer respectively) - this matches the pattern used for bytes() on Reader (with BytesReader). (I came across this when I wanted a trait object of a Buffer, so that I could use read_line(); rustc errors about std::io::Buffer not being object-safe.) [breaking-change] Any uses of Buffer::lines() will need to use the new trait std::io::LinesBuffer. The same is true for Buffer::chars() with std::io::CharsBuffer.
2014-11-16Move ToString to collections::stringBrendan Zabarauskas-69/+5
This also impls `FormatWriter` for `Vec<u8>`
2014-11-16Move IntoString to collections::stringBrendan Zabarauskas-10/+3
2014-11-16Rename IntoStr to IntoStringBrendan Zabarauskas-4/+4
For consistancy with ToString
2014-11-16Remove use of deprecated functionBrendan Zabarauskas-2/+3
2014-11-16Move FromStr to core::strBrendan Zabarauskas-648/+30
2014-11-15std: Fix a flaky test on OSX 10.10Alex Crichton-24/+22
This test was somewhat sketchy already with a `loop` around `write`, so this just adds some explicit synchronization to only call `write` once and guarantee that the error happens. Closes #18900
2014-11-15libstd: improve os::args() docLiigo Zhuang-0/+4
2014-11-14auto merge of #18880 : barosl/rust/doc-fail-to-panic, r=alexcrichtonbors-39/+40
I found some occurrences of "failure" and "fails" in the documentation. I changed them to "panics" if it means a task panic. Otherwise I left it as is, or changed it to "errors" to clearly distinguish them. Also, I made a minor fix that is breaking the layout of a module page. "Example" is shown in an irrelevant place from the following page: http://doc.rust-lang.org/std/os/index.html
2014-11-14auto merge of #18891 : erickt/rust/deprecate-as-ref, r=alexcrichtonbors-3/+38
It seems odd that the `AsRefReader`/`AsRefWriter` have the single method `by_ref()`. This creates the new traits `ByRefReader`/`ByRefWriter` and deprecates the old traits.
2014-11-13Rewrite std::sync::TaskPool to be load balancing and panic-resistantJonathan Reem-63/+167
The previous implementation was very likely to cause panics during unwinding through this process: - child panics, drops its receiver - taskpool comes back around and sends another job over to that child - the child receiver has hung up, so the taskpool panics on send - during unwinding, the taskpool attempts to send a quit message to the child, causing a panic during unwinding - panic during unwinding causes a process abort This meant that TaskPool upgraded any child panic to a full process abort. This came up in Iron when it caused crashes in long-running servers. This implementation uses a single channel to communicate between spawned tasks and the TaskPool, which significantly reduces the complexity of the implementation and cuts down on allocation. The TaskPool uses the channel as a single-producer-multiple-consumer queue. Additionally, through the use of send_opt and recv_opt instead of send and recv, this TaskPool is robust on the face of child panics, both before, during, and after the TaskPool itself is dropped. Due to the TaskPool no longer using an `init_fn_factory`, this is a [breaking-change] otherwise, the API has not changed. If you used `init_fn_factory` in your code, and this change breaks for you, you can instead use an `AtomicUint` counter and a channel to move information into child tasks.
2014-11-14auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichtonbors-166/+182
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below: [breaking-change] - `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`. - `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead. - `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers. - `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value. - `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that - `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically. - `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead. - The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt` - `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types. - `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-14Revert the need for initial values with arithmetic iteratorsBrendan Zabarauskas-2/+2
2014-11-13Make std::io::Buffer object-safe.Ricky Taylor-12/+25
[breaking-change] Any uses of Buffer::lines() and Buffer::chars() will need to use the new trait std::io::BufferPrelude.
2014-11-13std: Fix the return value of Duration::spanAlex Crichton-1/+8
The subtraction was erroneously backwards, returning negative durations! Closes #18925
2014-11-13auto merge of #18867 : michaelsproul/rust/unreachable-formatting, r=pcwaltonbors-1/+9
Closes #18842.
2014-11-12auto merge of #18858 : alexcrichton/rust/remove-time, r=jakubbors-0/+81
This commit deprecates the entire libtime library in favor of the externally-provided libtime in the rust-lang organization. Users of the `libtime` crate as-is today should add this to their Cargo manifests: [dependencies.time] git = "https://github.com/rust-lang/time" To implement this transition, a new function `Duration::span` was added to the `std::time::Duration` time. This function takes a closure and then returns the duration of time it took that closure to execute. This interface will likely improve with `FnOnce` unboxed closures as moving in and out will be a little easier. Due to the deprecation of the in-tree crate, this is a: [breaking-change] cc #18855, some of the conversions in the `src/test/bench` area may have been a little nicer with that implemented
2014-11-12auto merge of #18907 : alexcrichton/rust/snapshots, r=jakub-,jakubbors-23/+0
2014-11-12Register new snapshotsAlex Crichton-23/+0
2014-11-12auto merge of #18830 : adaszko/rust/patch-1, r=steveklabnikbors-1/+1
2014-11-12time: Deprecate the library in the distributionAlex Crichton-0/+81
This commit deprecates the entire libtime library in favor of the externally-provided libtime in the rust-lang organization. Users of the `libtime` crate as-is today should add this to their Cargo manifests: [dependencies.time] git = "https://github.com/rust-lang/time" To implement this transition, a new function `Duration::span` was added to the `std::time::Duration` time. This function takes a closure and then returns the duration of time it took that closure to execute. This interface will likely improve with `FnOnce` unboxed closures as moving in and out will be a little easier. Due to the deprecation of the in-tree crate, this is a: [breaking-change] cc #18855, some of the conversions in the `src/test/bench` area may have been a little nicer with that implemented
2014-11-13Remove Signed trait and add SignedInt traitBrendan Zabarauskas-5/+5
The methods have been moved into Float and SignedInt
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-4/+16
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13Deprecate Num, Unsigned and PrimitiveBrendan Zabarauskas-2/+2
2014-11-13Deprecate Zero and One traitsBrendan Zabarauskas-24/+20
2014-11-13Deprecate Bounded traitBrendan Zabarauskas-3/+2
2014-11-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-102/+90
2014-11-13Move saturating operator methods into IntBrendan Zabarauskas-1/+1
2014-11-13Create UnsignedInt trait and deprecate free functionsBrendan Zabarauskas-15/+14
2014-11-13Move abs_sub to FloatMathBrendan Zabarauskas-1/+23
This removes the need for libcore to depend on libm. `abs_sub` is not as useful for integers.
2014-11-13Take parameters by-value in Signed traitBrendan Zabarauskas-20/+20
2014-11-12auto merge of #18854 : thestinger/rust/spawn, r=aturonbors-1/+2
cc https://github.com/rust-lang/rust/issues/18000