summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-04-09Rollup merge of #24175 - dhuseby:bitrig_fixing_tests_2, r=alexcrichtonManish Goregaokar-1/+2
I'm not sure why this is failing. This patch disables this test until I can figure out what is wrong.
2015-04-08Implement io::Seek for io::BufWriter<W> where W: io::SeekKevin Ballard-0/+22
Seeking the `BufWriter` writes out its internal buffer before seeking.
2015-04-08Implement io::Seek for io::BufReader<R> where R: io::SeekKevin Ballard-2/+109
Seeking the `BufReader` discards the internal buffer (and adjusts the offset appropriately when seeking with `SeekFrom::Current(_)`).
2015-04-08std: Stabilize io::Error::from_raw_os_errorAlex Crichton-6/+12
This commit stabilizes the old `io::Error::from_os_error` after being renamed to use the `raw_os_error` terminology instead. This function is often useful when writing bindings to OS functions but only actually converting to an I/O error at a later point.
2015-04-08std: Destabilize the internals of panic!Alex Crichton-3/+1
Now that we have a `#[allow_internal_unstable]` attribute for macros there's no need for these two `begin_unwind` functions to be stable. Right now the `panic!` interface is the only one we wish to stabilize, so remove the stability markers from these functions. While this is a breaking change, it is highly unlikely to break any actual code. It is recommended to use the `panic!` macro instead if it breaks explicit calls into `std::rt`. [breaking-change] cc #24208
2015-04-08Auto merge of #24029 - nagisa:print-locking, r=alexcrichtonbors-34/+398
write_fmt calls write for each formatted field. The default implementation of write_fmt is used, which will call write on not-yet-locked stdout (and write locking after), therefore making print! in multithreaded environment still interleave contents of two separate prints. I’m not sure whether we want to do this change, though, because it has the same deadlock hazard which we tried to avoid by not locking inside write_fmt itself (see [this comment](https://github.com/rust-lang/rust/blob/80def6c2447d23a624e611417f24cf0ab2a5a676/src/libstd/io/stdio.rs#L267)). Spotted on [reddit]. cc @alexcrichton [reddit]: http://www.reddit.com/r/rust/comments/31comh/println_with_multiple_threads/
2015-04-08std: Fix fs::read_link behavior on WindowsAlex Crichton-14/+63
The current implementation of using GetFinalPathNameByHandle actually reads all intermediate links instead of just looking at the current link. This commit alters the behavior of the function to use a different API which correctly reads only one level of the soft link. [breaking-change]
2015-04-08Implement reentrant mutexes and make stdio use themSimonas Kazlauskas-34/+398
write_fmt calls write for each formatted field. The default implementation of write_fmt is used, which will call write on not-yet-locked stdout (and write locking after), therefore making print! in multithreaded environment still interleave contents of two separate prints. This patch implements reentrant mutexes, changes stdio handles to use these mutexes and overrides write_fmt to lock the stdio handle for the whole duration of the call.
2015-04-08Rollup merge of #24167 - hauleth:remove-incorrect-example-from-mpsc, ↵Steve Klabnik-52/+0
r=steveklabnik As beta is now released and is "suggested" version of `rustc` then there should be no code (in documentation) that will not compile with it. This one does not. So according to [this great talk](http://delete-your-code.herokuapp.com/), I am doing what should be done.
2015-04-07std: Reorganize thread::local a bitAlex Crichton-28/+26
Make the structure more amenable to what rustdoc is expecting to ensure that everything renders all nice and pretty in the output. Closes #23705 Closes #23910
2015-04-07std: Deny most warnings in doctestsAlex Crichton-224/+212
Allow a few specific ones but otherwise this helps ensure that our examples are squeaky clean! Closes #18199
2015-04-08Auto merge of #23293 - tbu-:pr_additive_multiplicative, r=alexcrichtonbors-6/+4
Previously it could not be implemented for types outside `libcore/iter.rs` due to coherence issues.
2015-04-07disabling a test that is failing on bitrig.Dave Huseby-1/+2
2015-04-08Make `sum` and `product` inherent methods on `Iterator`Tobias Bucher-6/+4
In addition to being nicer, this also allows you to use `sum` and `product` for iterators yielding custom types aside from the standard integers. Due to removing the `AdditiveIterator` and `MultiplicativeIterator` trait, this is a breaking change. [breaking-change]
2015-04-07Remove another invalid exampleŁukasz Niemier-26/+0
2015-04-07Remove incorrect example from docsŁukasz Niemier-26/+0
2015-04-06Remove outdated notice from BufRead::lines docs.Matt Brubeck-3/+0
There is no `read_string` function, and `lines` never returns an error.
2015-04-04fixing some tests and temporarily disabling others to get Bitrig build ↵Dave Huseby-1/+2
working 100%
2015-04-04Rollup merge of #24022 - steveklabnik:hn_fix, r=nikomatsakisManish Goregaokar-3/+2
from https://news.ycombinator.com/item?id=9317822
2015-04-04Rollup merge of #23979 - Ryman:error_from_string, r=alexcrichtonManish Goregaokar-3/+10
2015-04-03Don't speak of old_ioSteve Klabnik-3/+2
from https://news.ycombinator.com/item?id=9317822
2015-04-03Auto merge of #23832 - petrochenkov:usize, r=aturonbors-10/+10
These constants are small and can fit even in `u8`, but semantically they have type `usize` because they denote sizes and are almost always used in `usize` context. The change of their type to `u32` during the integer audit led only to the large amount of `as usize` noise (see the second commit, which removes this noise). This is a minor [breaking-change] to an unstable interface. r? @aturon
2015-04-02std: impl From<String> for Box<Error + Send>Kevin Butler-3/+10
2015-04-02Auto merge of #23931 - steveklabnik:doc_std_fs, r=alexcrichtonbors-42/+306
2015-04-02Auto merge of #23877 - richo:gardening, r=Manishearthbors-2/+1
I also wanted to unignore https://github.com/rust-lang/rust/blob/master/src/libsyntax/ext/expand.rs#L1768-L1777 since the issue it references is closed, but the test fails, and it's internals aren't super clear to me.
2015-04-02Add more examples and documentation for std::fsSteve Klabnik-42/+306
2015-04-02Tweak relese notes + rebase fixesAlex Crichton-6/+6
2015-04-01Test fixes and rebase conflicts, round 2Alex Crichton-25/+25
2015-04-01rollup merge of #23176: huonw/rm-boundsAlex Crichton-34/+36
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-18/+24
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01rollup merge of #23945: pnkfelix/gate-u-negateAlex Crichton-3/+3
Feature-gate unsigned unary negate. Discussed in weekly meeting here: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2015-03-31.md#feature-gate--expr and also in the internals thread here: http://internals.rust-lang.org/t/forbid-unsigned-integer/752
2015-04-02Test fixes and rebase conflicts, round 2Alex Crichton-2/+2
Conflicts: src/libcore/num/mod.rs
2015-04-01rollup merge of #23949: aturon/stab-timeoutAlex Crichton-28/+54
This commit renames and stabilizes: * `Condvar::wait_timeout_ms` (renamed from `wait_timeout`) * `thread::park_timeout_ms` (renamed from `park_timeout`) * `thread::sleep_ms` (renamed from `sleep`) In each case, the timeout is taken as a `u32` number of milliseconds, rather than a `Duration`. These functions are likely to be deprecated once a stable form of `Duration` is available, but there is little cost to having these named variants around, and it's crucial functionality for 1.0. [breaking-change] r? @alexcrichton cc @sfackler @carllerche
2015-04-01Stabilize basic timeout functionalityAaron Turon-28/+54
This commit renames and stabilizes: * `Condvar::wait_timeout_ms` (renamed from `wait_timeout`) * `thread::park_timeout_ms` (renamed from `park_timeout`) * `thread::sleep_ms` (renamed from `sleep`) In each case, the timeout is taken as a `u32` number of milliseconds, rather than a `Duration`. These functions are likely to be deprecated once a stable form of `Duration` is available, but there is little cost to having these named variants around, and it's crucial functionality for 1.0. [breaking-change]
2015-04-01fallout from feature-gating unary negation on unsigned integers.Felix S. Klock II-1/+1
2015-04-01rollup merge of #23939: nikomatsakis/fn-boxAlex Crichton-57/+27
Conflicts: src/liballoc/boxed.rs
2015-04-01rollup merge of #23951: alexcrichton/splitnAlex Crichton-3/+3
This commit is an implementation of [RFC 979][rfc] which changes the meaning of the count parameter to the `splitn` function on strings and slices. The parameter now means the number of items that are returned from the iterator, not the number of splits that are made. [rfc]: https://github.com/rust-lang/rfcs/pull/979 Closes #23911 [breaking-change]
2015-04-01std: Changing the meaning of the count to splitnAlex Crichton-3/+3
This commit is an implementation of [RFC 979][rfc] which changes the meaning of the count parameter to the `splitn` function on strings and slices. The parameter now means the number of items that are returned from the iterator, not the number of splits that are made. [rfc]: https://github.com/rust-lang/rfcs/pull/979 Closes #23911 [breaking-change]
2015-04-01rollup merge of #23942: vhbit/ios-randAlex Crichton-2/+2
2015-04-01rollup merge of #23867: nikomatsakis/issue-23086-take-3Alex Crichton-1/+153
This PR implements rust-lang/rfcs#1023. In the process it fixes #23086 and #23516. A few impls in libcore had to be updated, but the impact is generally pretty minimal. Most of the fallout is in the tests that probed the limits of today's coherence. I tested and we were able to build the most popular crates along with iron (modulo errors around errors being sendable). Fixes #23918.
2015-04-01Collect the definition of the `Error` trait into `libstd` for now. ThisNiko Matsakis-1/+153
sidesteps a coherence difficulty where `liballoc` had to prove that `&str: !Error`, which didn't involve any local types.
2015-04-02Rollup merge of #23932 - steveklabnik:doc_std_path, r=flaper87Manish Goregaokar-0/+213
2015-04-02Rollup merge of #23847 - bcoopers:read_clarification, r=sfacklerManish Goregaokar-8/+4
This introduces no functional changes except for reducing a few unnecessary operations and variables. Vec has the behavior that, if you request space past the capacity with reserve(), it will round up to the nearest power of 2. What that effectively means is that after the first call to reserve(16), we are doubling our capacity every time. So using the DEFAULT_BUF_SIZE and doubling cap_size() here is meaningless and has no effect on the call to reserve(). Note that with #23842 implemented this will hopefully have a clearer API and less of a need for commenting. If #23842 is not implemented then the most clear implementation would be to call reserve_exact(buf.capacity()) at every step (and making sure that buf.capacity() is not zero at the beginning of the function of course). Edit- functional change now introduced. We will now zero 16 bytes of the vector first, then double to 32, then 64, etc. until we read 64kB. This stops us from zeroing the entire vector when we double it, some of which may be wasted work. Reallocation still follows the doubling strategy, but the responsibility has been moved to vec.extend(), which calls reserve() and push_back().
2015-04-01Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an aliasNiko Matsakis-57/+26
for `Box<FnBox()>`. I found the alias was still handy because it is shorter than the fully written type. This is a [breaking-change]: convert code using `Invoke` to use `FnBox`, which is usually pretty straight-forward. Code using thunk mostly works if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to `foo(arg)`.
2015-04-01Add (unstable) FnBox trait as a nicer replacement for `Thunk`. The docNiko Matsakis-0/+1
comment includes a test that also shows how it can be used.
2015-04-01std: Unignore a test for #10663Richo Healey-2/+1
This issue is long closed. It seems that unwrapping will always panic though.
2015-04-01iOS: os::last_os_error() falloutValerii Hiora-2/+2
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-18/+24
2015-04-01Update android tests to reflect API switch from `os::env` to `env::vars`.Felix S. Klock II-4/+3
2015-04-01Test fixes and rebase conflictsAlex Crichton-7/+13