summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2016-08-22std: Stabilize APIs for the 1.12 releaseAlex Crichton-2/+3
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes #27708 cc #27709 Closes #32313 Closes #32630 Closes #32713 Closes #34029 Closes #34392 Closes #34285 Closes #34529
2016-08-14Rollup merge of #35574 - badboy:emscripten-test-fixes, r=brsonEduard-Mihai Burtescu-8/+9
Emscripten test fixes This picks up parts of #31623 to disable certain tests that emscripten can't run, as threads/processes are not supported. I re-applied @tomaka's changes manually, I can rebase those commits with his credentials if he wants. It also disables jemalloc for emscripten (at least in Rustbuild, I have to check if there is another setting for the same thing in the old makefile approach). This should not impact anything for normal builds.
2016-08-10Clarify std::os::unix::net::SocketAddr::is_unnamed's docstringPietro Albini-1/+1
2016-08-10Fix docs typo in std::os::unix::net::SocketAddr::is_unnamedPietro Albini-1/+1
2016-08-10[emscripten] Disable code paths that don't work on emscriptenJan-Erik Rediger-8/+9
2016-08-09Auto merge of #35426 - frewsxcv:os-sys-env-args-phantoms, r=alexcrichtonbors-6/+7
Utilize `PhantomData` to enforce `!Sync` and `!Send` field. None
2016-08-07Rollup merge of #35433 - mneumann:dragonfly-fix-libstd-errno-location, ↵Jonathan Turner-0/+1
r=alexcrichton Fix build on DragonFly (unused function errno_location) Function errno_location() is not used on DragonFly. As warnings are errors, this breaks the build.
2016-08-07Utilize `PhantomData` to enforce `!Sync` and `!Send` field.Corey Farwell-6/+7
2016-08-06Auto merge of #35378 - Amanieu:rwlock_eagain, r=alexcrichtonbors-1/+3
Handle RwLock reader count overflow `pthread_rwlock_rdlock` may return `EAGAIN` if the maximum reader count overflows. We shouldn't return a successful lock in that case.
2016-08-06Fix build on DragonFly (unused function errno_location)Michael Neumann-0/+1
Function errno_location() is not used on DragonFly. As warnings are errors, this breaks the build.
2016-08-06Rollup merge of #34916 - tbu-:pr_comment_on_seek_cast, r=GuillaumeGomezEduard-Mihai Burtescu-4/+8
Comment on the casts in the `seek` implementations on files
2016-08-05Handle RwLock reader count overflowAmanieu d'Antras-1/+3
2016-08-05Comment on the casts in the `seek` implementations on filesTobias Bucher-4/+8
2016-08-02Auto merge of #35084 - tbu-:pr_lowercase_wtf8_debug, r=brsonbors-2/+2
Escape the unmatched surrogates with lower-case hexadecimal numbers It's done the same way for the rest of the codepoint escapes.
2016-07-30Auto merge of #35051 - japaric:backtrace, r=alexcrichtonbors-0/+3
rustbuild: make backtraces (RUST_BACKTRACE) optional but keep them enabled by default to maintain the status quo. When disabled shaves ~56KB off every x86_64-unknown-linux-gnu binary. To disable backtraces you have to use a config.toml (see src/bootstrap/config.toml.example for details) when building rustc/std: $ python bootstrap.py --config=config.toml --- r? @alexcrichton cc rust-lang/rfcs#1417
2016-07-29Rollup merge of #35087 - GuillaumeGomez:fs_docs, r=steveklabnikGuillaume Gomez-0/+50
Fs docs Fixes #29356. r? @steveklabnik
2016-07-29Escape the unmatched surrogates with lower-case hexadecimal numbersTobias Bucher-2/+2
It's done the same way for the rest of the codepoint escapes.
2016-07-28Auto merge of #34485 - tbu-:pr_unicode_debug_str, r=alexcrichtonbors-3/+3
Escape fewer Unicode codepoints in `Debug` impl of `str` Use the same procedure as Python to determine whether a character is printable, described in [PEP 3138]. In particular, this means that the following character classes are escaped: - Cc (Other, Control) - Cf (Other, Format) - Cs (Other, Surrogate), even though they can't appear in Rust strings - Co (Other, Private Use) - Cn (Other, Not Assigned) - Zl (Separator, Line) - Zp (Separator, Paragraph) - Zs (Separator, Space), except for the ASCII space `' '` `0x20` This allows for user-friendly inspection of strings that are not English (e.g. compare `"\u{e9}\u{e8}\u{ea}"` to `"éèê"`). Fixes #34318. CC #34422. [PEP 3138]: https://www.python.org/dev/peps/pep-3138/
2016-07-28Add OpenOptionsExt doc examplesGuillaume Gomez-0/+38
2016-07-28Add doc examples for std::fs::unix::OpenOptionsExtGuillaume Gomez-0/+12
2016-07-27Auto merge of #34946 - alexcrichton:fix-cfg, r=brsonbors-2/+2
std: Fix usage of SOCK_CLOEXEC This code path was intended to only get executed on Linux, but unfortunately the `cfg!` was malformed so it actually never got executed.
2016-07-28Rename `char::escape` to `char::escape_debug` and add tracking issueTobias Bucher-3/+3
2016-07-27Auto merge of #33312 - Byron:double-ended-iterator-for-args, r=alexcrichtonbors-10/+21
DoubleEndedIterator for Args This PR implements the DoubleEndedIterator trait for the `std::env::Args[Os]` structure, as well as the internal implementations. It is primarily motivated by me, as I happened to implement a simple `reversor` program many times now, which so far had to use code like this: ```Rust for arg in std::env::args().skip(1).collect::<Vec<_>>().iter().rev() {} ``` ... even though I would have loved to do this instead: ```Rust for arg in std::env::args().skip(1).rev() {} ``` The latter is more natural, and I did not find a reason for not implementing it. After all, on every system, the number of arguments passed to the program are known at runtime. To my mind, it follows KISS, and does not try to be smart at all. Also, there are no unit-tests, primarily as I did not find any existing tests for the `Args` struct either. The windows implementation is basically a copy-pasted variant of the `next()` method implementation, and I could imagine sharing most of the code instead. Actually I would be happy if the reviewer would ask for it.
2016-07-26keep backtraces if using the old build systemJorge Aparicio-3/+3
2016-07-26Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnikSteve Klabnik-0/+16
Dir entry doc Part of #29356. r? @steveklabnik
2016-07-26rustbuild: make backtraces (RUST_BACKTRACE) optionalJorge Aparicio-0/+3
but keep them enabled by default to maintain the status quo. When disabled shaves ~56KB off every x86_64-unknown-linux-gnu binary. To disable backtraces you have to use a config.toml (see src/bootstrap/config.toml.example for details) when building rustc/std: $ python bootstrap.py --config=config.toml
2016-07-26DoubleEndedIterator for ArgsSebastian Thiel-10/+21
The number of arguments given to a process is always known, which makes implementing DoubleEndedIterator possible. That way, the Iterator::rev() method becomes usable, among others. Signed-off-by: Sebastian Thiel <byronimo@gmail.com> Tidy for DoubleEndedIterator I chose to not create a new feature for it, even though technically, this makes me lie about the original availability of the implementation. Verify with @alexchrichton Setup feature flag for new std::env::Args iterators Add test for Args reverse iterator It's somewhat depending on the input of the test program, but made in such a way that should be somewhat flexible to changes to the way it is called. Deduplicate windows ArgsOS code for DEI DEI = DoubleEndedIterator Move env::args().rev() test to run-pass It must be controlling it's arguments for full isolation. Remove superfluous feature name Assert all arguments returned by env::args().rev() Let's be very sure it works as we expect, why take chances. Fix rval of os_string_from_ptr A trait cannot be returned, but only the corresponding object. Deref pointers to actually operate on the argument Put unsafe to correct location
2016-07-24Add DirEntry doc examplesGuillaume Gomez-0/+16
2016-07-23Add DirBuilder doc examplesGuillaume Gomez-0/+10
2016-07-20std: Fix usage of SOCK_CLOEXECAlex Crichton-2/+2
This code path was intended to only get executed on Linux, but unfortunately the `cfg!` was malformed so it actually never got executed.
2016-07-15Rollup merge of #34456 - tbu-:pr_ptr_null, r=aturonGuillaume Gomez-16/+20
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 #34705 - alexcrichton:clean-deprecated, r=brsonbors-52/+64
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-52/+64
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-2/+2
Derive Debug on FileType. Partially fixes #32054
2016-07-12Use `ptr::{null, null_mut}` instead of `0 as *{const, mut}`Tobias Bucher-16/+20
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-11Auto merge of #34686 - alexcrichton:new-stage, r=luqmanabors-3/+3
rustc: Update stage0 to beta-2016-07-06 Hot off the presses, let's update our stage0 compiler!
2016-07-10Derive Debug on FileType.Martin Pool-2/+2
Partially fixes #32054
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-08Add test for std::net::lookup_host() duplicatesIvan Nejgebauer-0/+19
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-06rustc: Update stage0 to beta-2016-07-06Alex Crichton-3/+3
Hot off the presses, let's update our stage0 compiler!
2016-07-03Auto merge of #34530 - alexcrichton:stabilize-1.11, r=aturonbors-14/+54
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-14/+54
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-06-29Convert a simple tail call to a loopTobias Bucher-10/+14
2016-06-29Ignore unknown address types when looking up hostsTobias Bucher-5/+9
Previously, any function using a `ToSocketAddrs` input would fail if passed a hostname that resolves to an address type different from the ones recognized by Rust. This also changes the `LookupHost` iterator to only include the known address types, as a result, it doesn't have to return `Result`s any more, which are likely misinterpreted as failed name lookups.
2016-06-24Auto merge of #34441 - tbu-:pr_dont_ignore_errors, r=alexcrichtonbors-30/+30
Don't ignore errors of syscalls in std::sys::unix::fd If any of these syscalls fail, it indicates a programmer error that should not be silently ignored.