about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2015-01-21rollup merge of #21258: aturon/stab-3-indexAlex Crichton-12/+12
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
2015-01-21Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-68/+51
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-21rollup merge of #21444: petrochenkov/nullAlex Crichton-1/+2
Conflicts: src/libstd/sync/mpsc/select.rs
2015-01-21rollup merge of #21437: FlaPer87/snapshotAlex Crichton-3/+0
r? @alexcrichton
2015-01-21rollup merge of #21423: oli-obk/prettier_read_untilAlex Crichton-10/+8
Conflicts: src/libstd/io/mod.rs
2015-01-21rollup merge of #21396: japaric/no-parens-in-rangeAlex Crichton-5/+5
Conflicts: src/libsyntax/parse/lexer/comments.rs
2015-01-21rollup merge of #21389: retep998/timerAlex Crichton-0/+6
Fixes #20943 and adds a test for it r? @alexcrichton
2015-01-21Fallout from stabilization.Aaron Turon-12/+12
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-68/+51
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-20Register snapshot for 9006c3cFlavio Percoco-3/+0
2015-01-21Rollup merge of #21312 - michaelsproul:remove-error-send-bound, r=aturonBarosl LEE-3/+3
As discussed with @aturon, this PR removes the `Send` bound from `std::error::Error`, allowing us to implement `Error` for error types containing non-`Send` types. Current examples include `PoisonError` and `TryLockError` from `std::sync` which contain a Guard that we don't want sent between tasks. [breaking-change]
2015-01-20prettier Buffer::read_untilOliver Schneider-10/+8
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-5/+5
2015-01-19Impl Send for Timer on WindowsPeter Atashian-0/+6
Fixes #20943 Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-19Replace `0 as *const/mut T` with `ptr::null/null_mut()`we-1/+2
2015-01-17Remove Send bound from Error trait.Michael Sproul-3/+3
2015-01-17Evaluate # fn in docsSteve Klabnik-25/+14
I searched for times when we were hiding functions with # in the documentation, and fixed them to not use it unless neccesary. I also made random improvements whenever I changed something. For example, I changed Example to Examples, for consistency. Fixes #13423
2015-01-14use UFCS in `#[deriving(Hash)]`Jorge Aparicio-0/+2
expansion now uses `::std::hash::Hash::hash(&*__self_0_0, __arg_0)` instead of `(*__self_0_0).hash(__arg_0)` closes #21160
2015-01-14auto merge of #21076 : sfackler/rust/bufferedreader-undef, r=Gankrobors-11/+10
It's passed to the underlying reader, so uninitialized memory == sad times. We might want to shrink the default buffer size as well. 64k is pretty huge. Java uses 8k by default, and Go uses 4k for reference. r? @alexcrichton
2015-01-14auto merge of #21061 : japaric/rust/range, r=nick29581bors-17/+17
2015-01-12Initialize memory for BufferedReader bufferSteven Fackler-11/+10
It's passed to the underlying reader, so uninitialized memory == sad times. We might want to shrink the default buffer size as well. 64k is pretty huge. Java uses 8k by default, and Go uses 4k for reference.
2015-01-12cleanup: `&foo[0..a]` -> `&foo[..a]`Jorge Aparicio-17/+17
2015-01-12auto merge of #20896 : sfackler/rust/atomic-rename, r=alexcrichtonbors-3/+3
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-11Rename AtomicInt and AtomicUintSteven Fackler-3/+3
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-10Implement Show for types in std::io::{buffered,util}Steven Fackler-10/+46
A derived implementation would not be appropriate for the Buffered types since the buffer is both huge (64k by default) and full of uninitialized memory. Instead of printing the whole thing, we display how full it is. I also altered MultiWriter to make it generic over Writers instead of taking Box<Writer> trait objects. Box<Writer> implements Writer so existing use cases should continue to work, and this enables a more useful Show implementation in applicable cases. The change to MultiWriter may break code that uses it, but any fixes should be easy. [breaking-change]
2015-01-09Merge pull request #20699 from vhbit/ios-archsbors-8/+21
Better iOS support Reviewed-by: alexcrichton
2015-01-09iOS: fixed test buildValerii Hiora-8/+21
Now it is possible to run tests on a jailbroken device
2015-01-08Improvements to feature stagingBrian Anderson-31/+31
This gets rid of the 'experimental' level, removes the non-staged_api case (i.e. stability levels for out-of-tree crates), and lets the staged_api attributes use 'unstable' and 'deprecated' lints. This makes the transition period to the full feature staging design a bit nicer.
2015-01-07Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-33/+31
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
2015-01-07rollup merge of #20708: aturon/new-int-modulesAlex Crichton-9/+1
Conflicts: src/libserialize/lib.rs
2015-01-07use slicing sugarJorge Aparicio-33/+31
2015-01-07register new snapshotsJorge Aparicio-9/+1
2015-01-07std: Stabilize the std::hash moduleAlex Crichton-4/+4
This commit aims to prepare the `std::hash` module for alpha by formalizing its current interface whileholding off on adding `#[stable]` to the new APIs. The current usage with the `HashMap` and `HashSet` types is also reconciled by separating out composable parts of the design. The primary goal of this slight redesign is to separate the concepts of a hasher's state from a hashing algorithm itself. The primary change of this commit is to separate the `Hasher` trait into a `Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was actually just a factory for various states, but hashing had very little control over how these states were used. Additionally the old `Hasher` trait was actually fairly unrelated to hashing. This commit redesigns the existing `Hasher` trait to match what the notion of a `Hasher` normally implies with the following definition: trait Hasher { type Output; fn reset(&mut self); fn finish(&self) -> Output; } This `Hasher` trait emphasizes that hashing algorithms may produce outputs other than a `u64`, so the output type is made generic. Other than that, however, very little is assumed about a particular hasher. It is left up to implementors to provide specific methods or trait implementations to feed data into a hasher. The corresponding `Hash` trait becomes: trait Hash<H: Hasher> { fn hash(&self, &mut H); } The old default of `SipState` was removed from this trait as it's not something that we're willing to stabilize until the end of time, but the type parameter is always required to implement `Hasher`. Note that the type parameter `H` remains on the trait to enable multidispatch for specialization of hashing for particular hashers. Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is simply used as part `derive` and the implementations for all primitive types. With these definitions, the old `Hasher` trait is realized as a new `HashState` trait in the `collections::hash_state` module as an unstable addition for now. The current definition looks like: trait HashState { type Hasher: Hasher; fn hasher(&self) -> Hasher; } The purpose of this trait is to emphasize that the one piece of functionality for implementors is that new instances of `Hasher` can be created. This conceptually represents the two keys from which more instances of a `SipHasher` can be created, and a `HashState` is what's stored in a `HashMap`, not a `Hasher`. Implementors of custom hash algorithms should implement the `Hasher` trait, and only hash algorithms intended for use in hash maps need to implement or worry about the `HashState` trait. The entire module and `HashState` infrastructure remains `#[unstable]` due to it being recently redesigned, but some other stability decision made for the `std::hash` module are: * The `Writer` trait remains `#[experimental]` as it's intended to be replaced with an `io::Writer` (more details soon). * The top-level `hash` function is `#[unstable]` as it is intended to be generic over the hashing algorithm instead of hardwired to `SipHasher` * The inner `sip` module is now private as its one export, `SipHasher` is reexported in the `hash` module. And finally, a few changes were made to the default parameters on `HashMap`. * The `RandomSipHasher` default type parameter was renamed to `RandomState`. This renaming emphasizes that it is not a hasher, but rather just state to generate hashers. It also moves away from the name "sip" as it may not always be implemented as `SipHasher`. This type lives in the `std::collections::hash_map` module as `#[unstable]` * The associated `Hasher` type of `RandomState` is creatively called... `Hasher`! This concrete structure lives next to `RandomState` as an implemenation of the "default hashing algorithm" used for a `HashMap`. Under the hood this is currently implemented as `SipHasher`, but it draws an explicit interface for now and allows us to modify the implementation over time if necessary. There are many breaking changes outlined above, and as a result this commit is a: [breaking-change]
2015-01-07Register new snapshotsAlex Crichton-9/+1
2015-01-06More test fixesAlex Crichton-31/+31
2015-01-06Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-06rollup merge of #20615: aturon/stab-2-threadAlex Crichton-29/+33
This commit takes a first pass at stabilizing `std::thread`: * It removes the `detach` method in favor of two constructors -- `spawn` for detached threads, `scoped` for "scoped" (i.e., must-join) threads. This addresses some of the surprise/frustrating debug sessions with the previous API, in which `spawn` produced a guard that on destruction joined the thread (unless `detach` was called). The reason to have the division in part is that `Send` will soon not imply `'static`, which means that `scoped` thread creation can take a closure over *shared stack data* of the parent thread. On the other hand, this means that the parent must not pop the relevant stack frames while the child thread is running. The `JoinGuard` is used to prevent this from happening by joining on drop (if you have not already explicitly `join`ed.) The APIs around `scoped` are future-proofed for the `Send` changes by taking an additional lifetime parameter. With the current definition of `Send`, this is forced to be `'static`, but when `Send` changes these APIs will gain their full flexibility immediately. Threads that are `spawn`ed, on the other hand, are detached from the start and do not yield an RAII guard. The hope is that, by making `scoped` an explicit opt-in with a very suggestive name, it will be drastically less likely to be caught by a surprising deadlock due to an implicit join at the end of a scope. * The module itself is marked stable. * Existing methods other than `spawn` and `scoped` are marked stable. The migration path is: ```rust Thread::spawn(f).detached() ``` becomes ```rust Thread::spawn(f) ``` while ```rust let res = Thread::spawn(f); res.join() ``` becomes ```rust let res = Thread::scoped(f); res.join() ``` [breaking-change]
2015-01-06rollup merge of #19430: pczarn/interp_tt-cleanupAlex Crichton-9/+11
Conflicts: src/libsyntax/parse/parser.rs
2015-01-06rollup merge of #20607: nrc/kindsAlex Crichton-2/+2
Conflicts: src/libcore/array.rs src/libcore/cell.rs src/libcore/prelude.rs src/libstd/path/posix.rs src/libstd/prelude/v1.rs src/test/compile-fail/dst-sized-trait-param.rs
2015-01-06rollup merge of #20593: nikomatsakis/unused-tps-in-implAlex Crichton-0/+1
Conflicts: src/libcollections/lib.rs src/librustc/lib.rs src/libserialize/lib.rs src/libstd/lib.rs
2015-01-07Cleanup and followup to PR #17830: parsing changesPiotr Czarnecki-9/+11
Prevents breaking down `$name` tokens into separate `$` and `name`. Reports unknown macro variables. Fixes #18775 Fixes #18839 Fixes #15640
2015-01-06Register new snapshotsAlex Crichton-5/+1
Conflicts: src/librbml/lib.rs src/libserialize/json_stage0.rs src/libserialize/serialize_stage0.rs src/libsyntax/ast.rs src/libsyntax/ext/deriving/generic/mod.rs src/libsyntax/parse/token.rs
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-48/+69
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-07markers -> markerNick Cameron-2/+2
2015-01-07falloutNick Cameron-28/+24
2015-01-06Fallout from stabilizationAaron Turon-29/+33
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-48/+69
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-06Fix fallout in libs. For the most part I just tagged impls as ↵Niko Matsakis-0/+1
`#[old_impl_check]`.