about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
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-09Add the unstable attribute to the new mpsc::Receiver::try_iter APImitchmindtree-0/+3
2016-07-09Add a test for Receiver::try_itermitchmindtree-0/+28
2016-07-08add a non blocking iterator for the mpsc::Receivermitchmindtree-0/+25
Currently, the `mpsc::Receiver` offers methods for receiving values in both blocking (`recv`) and non-blocking (`try_recv`) flavours. However only blocking iteration over values is supported. This commit adds a non-blocking iterator to complement the `try_recv` method, just as the blocking iterator complements the `recv` method.
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-07Add links to Ipv*Addr methods in docsMatt Horn-5/+15
per https://github.com/rust-lang/rust/pull/34694#issuecomment-231126489
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-06Properly mark new methods as unstableMatt Horn-5/+8
2016-07-06Mark new methods as unstableMatt Horn-0/+5
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-06Add IpAddr common methodsMatt Horn-0/+103
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