about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-07-19Auto merge of #33974 - habnabit:eintr-retry-for-read-iterators, r=alexcrichtonbors-11/+18
Retry on EINTR in Bytes and Chars. >Since Bytes and Chars called directly into Read::read, they didn't use any of the retrying wrappers. This allows both iterator types to retry.
2016-07-16Revert "Refactored code to access TLS only in case of panic"Tim Neumann-11/+9
2016-07-16Merge pull request #34836 from cynicaldevil/panic-counterAlex Crichton-9/+11
Refactored code to access TLS only in case of panic
2016-07-16Refactored code to access TLS only in case of panicNikhil Shagrithaya-9/+11
2016-07-15Rollup merge of #34794 - frewsxcv:exitstatus-success, r=GuillaumeGomezGuillaume Gomez-0/+17
Add doc example for `std::process::ExitStatus::success`. None
2016-07-15Rollup merge of #34777 - glandium:issue34697, r=GuillaumeGomezGuillaume Gomez-1/+3
doc: Mention that writeln! and println! always use LF Fixes #34697 I'm not really satisfied with the wording, but I didn't have a better idea. Suggestions welcome.
2016-07-15Rollup merge of #34456 - tbu-:pr_ptr_null, r=aturonGuillaume Gomez-17/+22
Use `ptr::{null, null_mut}` instead of `0 as *{const, mut}`
2016-07-13Auto merge of #34776 - cuviper:solaris-readdir, r=alexcrichtonbors-22/+40
std: fix `readdir` errors for solaris A `NULL` from `readdir` could be the end of stream or an error. The only way to know is to check `errno`, so it must be set to a known value first, like a 0 that POSIX will never use. This currently only matters for solaris targets, as the other unix platforms are using `readdir_r` with a direct error return indication. However, this is getting deprecated (#34668) so they should all eventually switch to `readdir`. This PR adds `set_errno`, uses it to clear the value before calling `readdir`, then checks it again after to see the reason for a `NULL`. A few other small fixes are included just to get solaris compiling at all. I couldn't get cross-compilation completely going, so I don't have a good way to test this beyond a smoke-test cargo build of std. I'd appreciate input from someone more familiar with solaris -- cc @nbaksalyar?
2016-07-12Auto merge of #34756 - habnabit:mutex-refunwindsafe, r=alexcrichtonbors-0/+5
Mutex and RwLock need RefUnwindSafe too Incomplete, because I don't know what the appropriate stability annotation is here, but this is an attempt to bring the documentation for `std::panic` in line with reality. Right now, it says: >Types like `&Mutex<T>`, however, are unwind safe because they implement poisoning by default. But only `Mutex<T>`, not `&Mutex<T>`, is unwind-safe.
2016-07-12Auto merge of #34739 - therealbstern:ipv4unspec, r=alexcrichtonbors-0/+4
Mark Ipv4Addr is_unspecified as stable and provide reference. Per [#27709 (comment)](https://github.com/rust-lang/rust/issues/27709#issuecomment-231280999), no RFC is needed here. IPv4 "unspecified" has been defined in [Stevens], and has been part of the IPv4 stack for quite some time. This property should become stable, since this use of 0.0.0.0 is not going anywhere. [Stevens][_UNIX Network Programming Volume 1, Second Edition_. Stevens, W. Richard. Prentice-Hall, 1998. p. 891] Please let me know if I got the rustdoc wrong or something. I tried to be as terse as possible while still conveying the appropriate information. This also has a slight impact on PR #34694, but that one came first, so this shouldn't block it, IMO.
2016-07-12Add doc example for `std::process::ExitStatus::success`.Corey Farwell-0/+17
2016-07-12Auto merge of #34705 - alexcrichton:clean-deprecated, r=brsonbors-732/+234
std: Clean out deprecated APIs This primarily removes a lot of `sync::Static*` APIs and rejiggers the associated implementations. While doing this it was discovered that the `is_poisoned` method can actually result in a data race for the Mutex/RwLock primitives, so the inner `Cell<bool>` was changed to an `AtomicBool` to prevent the associated data race. Otherwise the usage/gurantees should be the same they were before.
2016-07-12std: Clean out deprecated APIsAlex Crichton-732/+234
This primarily removes a lot of `sync::Static*` APIs and rejiggers the associated implementations. While doing this it was discovered that the `is_poisoned` method can actually result in a data race for the Mutex/RwLock primitives, so the inner `Cell<bool>` was changed to an `AtomicBool` to prevent the associated data race. Otherwise the usage/gurantees should be the same they were before.
2016-07-12Auto merge of #34757 - sourcefrog:debug-filetype, r=alexcrichtonbors-3/+3
Derive Debug on FileType. Partially fixes #32054
2016-07-12Rollup merge of #34750 - GuillaumeGomez:error_doc, r=steveklabnikGuillaume Gomez-0/+70
Add examples for std::Error module Fixes #29352. r? @steveklabnik
2016-07-12Rollup merge of #34737 - frewsxcv:libstd-process-child, r=GuillaumeGomezGuillaume Gomez-11/+29
Various `std::process` doc improvements. None
2016-07-12Use `ptr::{null, null_mut}` instead of `0 as *{const, mut}`Tobias Bucher-17/+22
2016-07-12doc: Mention that writeln! and println! always use LFMike Hommey-1/+3
Fixes #34697
2016-07-11std: clear errno before readdir, then check it (solaris)Josh Stone-17/+32
A `NULL` from `readdir` could be the end of stream or an error. The only way to know is to check `errno`, so it must be set to a known value first, like a 0 that POSIX will never use. This patch adds `set_errno`, uses it to clear the value before calling `readdir`, then checks it again after to see the reason for a `NULL`.
2016-07-11std: Fix IPV6 imports for solarisJosh Stone-4/+8
Like BSDs, Solaris maps `IPV6_ADD_MEMBERSHIP` and `IPV6_DROP_MEMBERSHIP` from `IPV6_JOIN_GROUP` and `IPV6_LEAVE_GROUP` respectively.
2016-07-11std: Fix `Thread::set_name()` for newlib and solarisJosh Stone-1/+0
The `use ffi::CStr` in `unix/thread.rs` was previously guarded, but now all platforms need it for `Thread::set_name()`. Newlib and Solaris do nothing here, as they have no way to set a thread name, but they still define the same method signature.
2016-07-11Mark Ipv4Addr is_unspecified as stable and provide reference.Ben Stern-0/+4
2016-07-11Auto merge of #34686 - alexcrichton:new-stage, r=luqmanabors-15/+3
rustc: Update stage0 to beta-2016-07-06 Hot off the presses, let's update our stage0 compiler!
2016-07-11`std::process` doc improvements.Corey Farwell-11/+29
* Link to `process::Command` from `process::Child`. * Move out inline Markdown link in doc comment. * Link to `process::Child::wait` from `process::Child`. * Link to `process::Child` from `process::ChildStdin`. * Link to `process::Child` from `process::ChildStdout`. * Link to `process::Child` from `process::ChildStderr`.
2016-07-11Set unwind_safe_lock_refs stability to 1.12.0.Aaron Gallagher-3/+2
This is the first (and presumably only) use of this feature.
2016-07-10Derive Debug on FileType.Martin Pool-3/+3
Partially fixes #32054
2016-07-10Mutex and RwLock need RefUnwindSafe too.Aaron Gallagher-0/+6
2016-07-10Add examples for std::Error moduleGuillaume Gomez-0/+70
2016-07-10Demangle curly bracesSteven Fackler-1/+3
They show up in things like fn(&std..panic..PanicInfo<'_>) $u7b$hook$u7d$::fn_pointer_shim.8352::h01f889b2277c719d
2016-07-10Auto merge of #34731 - GGist:fix_sync_try_recv, r=alexcrichtonbors-1/+10
Check for data in Receiver::try_recv before reporting disconnect Fixes #34711 r? @alexcrichton
2016-07-09Auto merge of #34717 - frewsxcv:sink, r=apasel422bors-2/+2
Remove unnecessarily mutable reference in doc example. None
2016-07-09Auto merge of #34709 - GuillaumeGomez:primitives, r=steveklabnikbors-0/+30
Improve primitive integers documentation Fixes #29335. r? @steveklabnik
2016-07-08Check for data in Receiver::try_recv before reporting disconnectAndrew-1/+10
2016-07-08Auto merge of #34700 - inejge:ai-hints, r=alexcrichtonbors-0/+19
Use hints with getaddrinfo() in std::net::lookup_host() As noted in #24250, `std::net::lookup_host()` repeats each IPv[46] address in the result set. The number of repetitions is OS-dependent; e.g., Linux and FreeBSD give three copies, OpenBSD gives two. Filtering the duplicates can be done by the user if `lookup_host()` is used explicitly, but not with functions like `TcpStream::connect()`. What happens with the latter is that any unsuccessful connection attempt will be repeated as many times as there are duplicates of the address. The program: ```rust use std::net::TcpStream; fn main() { let _stream = TcpStream::connect("localhost:4444").unwrap(); } ``` results in the following capture: [capture-before.txt](https://github.com/rust-lang/rust/files/352004/capture-before.txt) assuming that "localhost" resolves both to ::1 and 127.0.0.1, and that the listening program opens just an IPv4 socket (e.g., `nc -l 127.0.0.1 4444`.) The reason for this behavior is explained in [this comment](https://github.com/rust-lang/rust/issues/24250#issuecomment-92240152): `getaddrinfo()` is not constrained. Various OSS projects (I checked out Postfix, OpenLDAP, Apache HTTPD and BIND) which use `getaddrinfo()` generally constrain the result set by using a non-NULL `hints` parameter and setting at least `ai_socktype` to `SOCK_STREAM`. `SOCK_DGRAM` would also work. Other parameters are unnecessary for pure name resolution. The patch in this PR initializes a `hints` struct and passes it to `getaddrinfo()`, which eliminates the duplicates. The same test program as above with this change produces: [capture-after.txt](https://github.com/rust-lang/rust/files/352042/capture-after.txt) All `libstd` tests pass with this patch.
2016-07-08Improve primitive integers documentationGuillaume Gomez-0/+30
2016-07-08Add test for std::net::lookup_host() duplicatesIvan Nejgebauer-0/+19
2016-07-08Rollup merge of #34700 - inejge:ai-hints, r=alexcrichtonManish Goregaokar-1/+11
Use hints with getaddrinfo() in std::net::lookup_host() As noted in #24250, `std::net::lookup_host()` repeats each IPv[46] address in the result set. The number of repetitions is OS-dependent; e.g., Linux and FreeBSD give three copies, OpenBSD gives two. Filtering the duplicates can be done by the user if `lookup_host()` is used explicitly, but not with functions like `TcpStream::connect()`. What happens with the latter is that any unsuccessful connection attempt will be repeated as many times as there are duplicates of the address. The program: ```rust use std::net::TcpStream; fn main() { let _stream = TcpStream::connect("localhost:4444").unwrap(); } ``` results in the following capture: [capture-before.txt](https://github.com/rust-lang/rust/files/352004/capture-before.txt) assuming that "localhost" resolves both to ::1 and 127.0.0.1, and that the listening program opens just an IPv4 socket (e.g., `nc -l 127.0.0.1 4444`.) The reason for this behavior is explained in [this comment](https://github.com/rust-lang/rust/issues/24250#issuecomment-92240152): `getaddrinfo()` is not constrained. Various OSS projects (I checked out Postfix, OpenLDAP, Apache HTTPD and BIND) which use `getaddrinfo()` generally constrain the result set by using a non-NULL `hints` parameter and setting at least `ai_socktype` to `SOCK_STREAM`. `SOCK_DGRAM` would also work. Other parameters are unnecessary for pure name resolution. The patch in this PR initializes a `hints` struct and passes it to `getaddrinfo()`, which eliminates the duplicates. The same test program as above with this change produces: [capture-after.txt](https://github.com/rust-lang/rust/files/352042/capture-after.txt) All `libstd` tests pass with this patch.
2016-07-08Rollup merge of #34659 - GuillaumeGomez:path_file_name, r=steveklabnikManish Goregaokar-2/+12
Fix `std::path::Path::file_name()` doc Fixes #34632 r? @steveklabnik
2016-07-08Rollup merge of #34612 - frewsxcv:io-error-from_raw_os_error, r=steveklabnikManish Goregaokar-0/+24
Add doc examples for `io::Error::from_raw_os_error`. None
2016-07-07Remove unnecessarily mutable reference in doc example.Corey Farwell-2/+2
2016-07-07Use hints with getaddrinfo() in std::net::lokup_host()Ivan Nejgebauer-1/+11
When resolving a hostname, pass a hints struct where ai_socktype is set to SOCK_STREAM in order to eliminate repeated results for each protocol family.
2016-07-06Add doc examples for `io::Error::from_raw_os_error`.Corey Farwell-0/+24
2016-07-06Rollup merge of #34626 - sylvestre:master, r=ManishearthSteve Klabnik-1/+1
Fix typos
2016-07-06rustc: Update stage0 to beta-2016-07-06Alex Crichton-15/+3
Hot off the presses, let's update our stage0 compiler!
2016-07-06Fix `std::path::Path::file_name()` docggomez-2/+12
2016-07-04Auto merge of #34590 - pwlandoll:master, r=apasel422bors-2/+1
Issue #34076: Removing reference to removed path.prefix() function In the documentation for `std::path::Path`, there is a [reference](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_absolute) to the `path.prefix()` function which has since been removed. The offending reference is now also removed. First pull request, feedback welcome! r? @steveklabnik
2016-07-03Auto merge of #34530 - alexcrichton:stabilize-1.11, r=aturonbors-18/+93
std: Stabilize APIs for the 1.11.0 release Although the set of APIs being stabilized this release is relatively small, the trains keep going! Listed below are the APIs in the standard library which have either transitioned from unstable to stable or those from unstable to deprecated. Stable * `BTreeMap::{append, split_off}` * `BTreeSet::{append, split_off}` * `Cell::get_mut` * `RefCell::get_mut` * `BinaryHeap::append` * `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past libstd stabilizations * `Iterator::sum` * `Iterator::product` Deprecated * `{f32, f64}::next_after` * `{f32, f64}::integer_decode` * `{f32, f64}::ldexp` * `{f32, f64}::frexp` * `num::One` * `num::Zero` Added APIs (all unstable) * `iter::Sum` * `iter::Product` * `iter::Step` - a few methods were added to accomodate deprecation of One/Zero Removed APIs * `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is unstable Closes #27739 Closes #27752 Closes #32526 Closes #33444 Closes #34152 cc #34529 (new tracking issue)
2016-07-03std: Stabilize APIs for the 1.11.0 releaseAlex Crichton-18/+93
Although the set of APIs being stabilized this release is relatively small, the trains keep going! Listed below are the APIs in the standard library which have either transitioned from unstable to stable or those from unstable to deprecated. Stable * `BTreeMap::{append, split_off}` * `BTreeSet::{append, split_off}` * `Cell::get_mut` * `RefCell::get_mut` * `BinaryHeap::append` * `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past libstd stabilizations * `Iterator::sum` * `Iterator::product` Deprecated * `{f32, f64}::next_after` * `{f32, f64}::integer_decode` * `{f32, f64}::ldexp` * `{f32, f64}::frexp` * `num::One` * `num::Zero` Added APIs (all unstable) * `iter::Sum` * `iter::Product` * `iter::Step` - a few methods were added to accomodate deprecation of One/Zero Removed APIs * `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is unstable Closes #27739 Closes #27752 Closes #32526 Closes #33444 Closes #34152 cc #34529 (new tracking issue)
2016-07-03Fix a few typos in the codeSylvestre Ledru-1/+1
2016-07-02Rollup merge of #34583 - steveklabnik:remove-unneeded-deprecated, r=alexcrichtonManish Goregaokar-1/+0
remove unneeded allow flag There isn't anything deprecated being used in this function. This built fine for me locally, but just to be sure, should check Travis.