summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
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
2014-11-11std: Rename AsRef{Reader,Writer} to ByRef{Reader,Writer}Erick Tryzelaar-3/+38
2014-11-12Fix documentation bugBarosl Lee-0/+1
The first paragraph must be separated from the next paragraph. Otherwise, rustdoc will consider the content of the latter as part of the title.
2014-11-12Fix remaining documentation to reflect fail!() -> panic!()Barosl Lee-39/+39
Throughout the docs, "failure" was replaced with "panics" if it means a task panic. Otherwise, it remained as is, or changed to "errors" to clearly differentiate it from a task panic.
2014-11-10Add optional messages to the unreachable macro.Michael Sproul-1/+9
Closes #18842.
2014-11-10note the intent of reforming task spawningDaniel Micay-1/+2
2014-11-10Fix 'renamed lint' warningsMichael Gehring-3/+3
2014-11-10Fix broken documentation linkAdam Szkoda-1/+1
2014-11-08Runtime removal: fully remove rtioAaron Turon-13/+7
This patch cleans up the remnants of the runtime IO interface. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: refactor ttyAaron Turon-33/+235
This patch continues runtime removal by moving the tty implementations into `sys`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: refactor timerAaron Turon-11/+500
This patch continues runtime removal by moving out timer-related code into `sys`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: refactor processAaron Turon-90/+1250
This patch continues the runtime removal by moving and refactoring the process implementation into the new `sys` module. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: refactor helper threadsAaron Turon-0/+224
This patch continues the runtime removal by moving libnative::io::helper_thread into sys::helper_signal and sys_common::helper_thread Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: refactor pipes and networkingAaron Turon-283/+2569
This patch continues the runtime removal by moving pipe and networking-related code into `sys`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: refactor fsAaron Turon-224/+966
This moves the filesystem implementation from libnative into the new `sys` modules, refactoring along the way and hooking into `std::io::fs`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-08Runtime removal: add private sys, sys_common modulesAaron Turon-238/+1093
These modules will house the code that used to be part of the runtime system in libnative. The `sys_common` module contains a few low-level but cross-platform details. The `sys` module is set up using `#[cfg()]` to include either a unix or windows implementation of a common API surface. This API surface is *not* exported directly in `libstd`, but is instead used to bulid `std::os` and `std::io`. Ultimately, the low-level details in `sys` will be exposed in a controlled way through a separate platform-specific surface, but that setup is not part of this patch.
2014-11-08Implements Extend for EnumSet and LruCachegamazeps-1/+10
Part of #18424
2014-11-08Renamed Extendable to Extendgamazeps-8/+8
In order to upgrade, simply rename the Extendable trait to Extend in your code Part of #18424 [breaking-change]
2014-11-07auto merge of #18714 : nikomatsakis/rust/issue-18621-deref-for-refs, r=aturonbors-0/+4
libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this. r? @aturon
2014-11-06libs: add Deref, DerefMut impls for references, fixing a bug in compiler in ↵Niko Matsakis-0/+4
the process that was blocking this. Fixes #18621.
2014-11-07auto merge of #18713 : juxiliary/rust/master, r=alexcrichtonbors-1/+17
* `from_str_radix_float` gives incorrect results for negative float strings. Changes the accumulator used to start at -0.0 instead of -1.0. * Adds missing tests
2014-11-06Test fixes and rebase conflictsAlex Crichton-1/+1
2014-11-06rollup merge of #18691 : subhashb/add_clone_trait_to_filetypeAlex Crichton-1/+1
2014-11-06rollup merge of #18665 : scribu/patch-1Alex Crichton-1/+1
2014-11-06rollup merge of #18664 : klutzy/getrandomAlex Crichton-12/+120