about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-07-30remove some `any`s that are no longer necessaryJorge Aparicio-3/+3
2016-07-30arm-musl targets now use cfg(env = "musl")Jorge Aparicio-9/+3
2016-07-30Add ARM MUSL targets.Timon Van Overveldt-3/+9
The targets are: - `arm-unknown-linux-musleabi` - `arm-unknown-linux-musleabihf` - `armv7-unknown-linux-musleabihf` These mirror the existing `gnueabi` targets. All of these targets produce fully static binaries, similar to the x86 MUSL targets. For now these targets can only be used with `--rustbuild` builds, as https://github.com/rust-lang/compiler-rt/pull/22 only made the necessary compiler-rt changes in the CMake configs, not the plain GNU Make configs. I've tested these targets GCC 5.3.0 compiled again musl-1.1.12 (downloaded from http://musl.codu.org/). An example `./configure` invocation is: ``` ./configure \ --enable-rustbuild --target=arm-unknown-linux-musleabi \ --musl-root="$MUSL_ROOT" ``` where `MUSL_ROOT` points to the `arm-linux-musleabi` prefix. Usually that path will be of the form `/foobar/arm-linux-musleabi/arm-linux-musleabi`. Usually the cross-compile toolchain will live under `/foobar/arm-linux-musleabi/bin`. That path should either by added to your `PATH` variable, or you should add a section to your `config.toml` as follows: ``` [target.arm-unknown-linux-musleabi] cc = "/foobar/arm-linux-musleabi/bin/arm-linux-musleabi-gcc" cxx = "/foobar/arm-linux-musleabi/bin/arm-linux-musleabi-g++" ``` As a prerequisite you'll also have to put a cross-compiled static `libunwind.a` library in `$MUSL_ROOT/lib`. This is similar to [how the x86_64 MUSL targets are built] (https://doc.rust-lang.org/book/advanced-linking.html).
2016-07-30Update gcc crate dependency to 0.3.27.Timon Van Overveldt-1/+1
This is to pull in changes to support ARM MUSL targets. This change also commits a couple of other cargo-generated changes to other dependencies in the various Cargo.toml files.
2016-07-30Add urls in std::io typesGuillaume Gomez-2/+14
2016-07-30Add io::Take doc exampleGuillaume Gomez-0/+18
2016-07-30Auto merge of #35051 - japaric:backtrace, r=alexcrichtonbors-10/+25
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-30Add doc example for StdoutGuillaume Gomez-0/+15
2016-07-30Add doc example for StdinGuillaume Gomez-0/+15
2016-07-30Add doc example for io::StderrGuillaume Gomez-0/+15
2016-07-29Add io::Error doc examplesGuillaume Gomez-0/+145
2016-07-29Rollup merge of #35087 - GuillaumeGomez:fs_docs, r=steveklabnikGuillaume Gomez-0/+101
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-10/+11
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-28Add doc examples for std::fs::MetadataGuillaume Gomez-0/+51
2016-07-28Rename `char::escape` to `char::escape_debug` and add tracking issueTobias Bucher-10/+11
2016-07-27Auto merge of #33312 - Byron:double-ended-iterator-for-args, r=alexcrichtonbors-10/+32
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-14/+16
2016-07-26Rollup merge of #35010 - GuillaumeGomez:file_doc, r=steveklabnikSteve Klabnik-5/+23
Improve Open doc Part of #29356. r? @steveklabnik
2016-07-26Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnikSteve Klabnik-12/+100
Dir entry doc Part of #29356. r? @steveklabnik
2016-07-26Rollup merge of #35001 - rdwilliamson:patch-1, r=alexcrichtonSteve Klabnik-1/+1
Fix HashMap's values_mut example to use println! Fix HashMap's values_mut example to use println!
2016-07-26Rollup merge of #34995 - GuillaumeGomez:dir_builder_doc, r=steveklabnikSteve Klabnik-1/+28
Add DirBuilder doc examples r? @steveklabnik Part of #29329 and of #29356.
2016-07-26Rollup merge of #34935 - GuillaumeGomez:hash_map_doc, r=steveklabnikSteve Klabnik-5/+198
Add HashMap Entry enums examples Part of #29348. r? @steveklabnik
2016-07-26rustbuild: make backtraces (RUST_BACKTRACE) optionalJorge Aparicio-5/+18
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/+32
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-24Improve Open docGuillaume Gomez-5/+23
2016-07-24Add DirEntry doc examplesGuillaume Gomez-0/+71
2016-07-24Add missing linksGuillaume Gomez-12/+29
2016-07-24Rollup merge of #34975 - GuillaumeGomez:random_state_doc, r=steveklabnikManish Goregaokar-0/+19
Add Random state doc Last part of #29348. r? @steveklabnik
2016-07-23Fix HashMap's values_mut example to use println!Robert Williamson-1/+1
2016-07-23Add DirBuilder doc examplesGuillaume Gomez-1/+28
2016-07-22Add Random state docggomez-0/+19
2016-07-22Add HashMap Entry enums examplesggomez-5/+198
2016-07-21Auto merge of #34724 - mitchmindtree:mpsc_receiver_try_recv, r=alexcrichtonbors-0/+56
Add a method to the mpsc::Receiver for producing a non-blocking iterator 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 PR adds a non-blocking iterator to complement the `try_recv` method, just as the blocking iterator complements the `recv` method. Use-case ------------- I predominantly use rust in my work on real-time systems and in particular real-time audio generation/processing. I use `mpsc::channel`s to communicate between threads in a purely non-blocking manner. I.e. I might send messages from the GUI thread to the audio thread to update the state of the dsp-graph, or from the audio thread to the GUI thread to display the RMS of each node. These are just a couple examples (I'm probably using 30+ channels across my various projects). I almost exclusively use the `mpsc::Receiver::try_recv` method to avoid blocking any of the real-time threads and causing unwanted glitching/stuttering. Now that I mention it, I can't think of a single time that I personally have used the `recv` method (though I can of course see why it would be useful, and perhaps the common case for many people). As a result of this experience, I can't help but feel there is a large hole in the `Receiver` API. | blocking | non-blocking | |------------|--------------------| | `recv` | `try_recv` | | `iter` | 🙀 | For the most part, I've been working around this using `while let Ok(v) = r.try_recv() { ... }`, however as nice as this is, it is clearly no match for the Iterator API. As an example, in the majority of my channel use cases I only want to check for *n* number of messages before breaking from the loop so that I don't miss the audio IO callback or hog the GUI thread for too long when an unexpectedly large number of messages are sent. Currently, I have to write something like this: ```rust let mut take = 100; while let Ok(msg) = rx.try_recv() { // Do stuff with msg if take == 0 { break; } take -= 1; } ``` or wrap the `try_recv` call in a `Range<usize>`/`FilterMap` iterator combo. On the other hand, this PR would allow for the following: ```rust for msg in rx.try_iter().take(100) { // Do stuff with msg } ``` I imagine this might also be useful to game devs, embedded or anyone doing message passing across real-time threads.
2016-07-21Fix issue in receiver_try_iter test where response sender would panic ↵mitchmindtree-3/+3
instead of break from the loop
2016-07-21Rollup merge of #34937 - GuillaumeGomez:hash_map_entry_debug, r=apasel422Guillaume Gomez-0/+33
Add debug for hash_map::{Entry, VacantEntry, OccupiedEntry} r? @alexcrichton
2016-07-21Rollup merge of #34895 - mark-buer:patch-1, r=steveklabnikGuillaume Gomez-2/+2
Remove rustdoc reference to `walk_dir`
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-20Fix typo (privledge->privilege)Patrick McCann-1/+1
2016-07-20Auto merge of #34694 - mathphreak:master, r=alexcrichtonbors-0/+121
Add IpAddr common methods Per https://github.com/rust-lang/rfcs/pull/1668#issuecomment-230867962 no RFC is needed here. The generated documentation for these methods is being weird. It shows a deprecation message referencing #27709 for each of them even though two of the referenced methods were stabilized as part of that issue. I don't know how best to address that.
2016-07-20Auto merge of #33526 - steveklabnik:gh21889, r=alexcrichtonbors-0/+38
Add some warnings to std::env::current_exe /cc #21889 @rust-lang/libs @semarie I started writing this up. I'm not sure if we want to go into other things and in what depth; we don't currently have a lot of security-specific documentation to model after. Thoughts?
2016-07-20Add the missing tracking issue field for #34931 to the receiver_try_iter ↵mitchmindtree-3/+3
stability attributes
2016-07-19re-work exampleSteve Klabnik-12/+35
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-18Remove rustdoc reference to `walk_dir`Mark Buer-2/+2
2016-07-18Add debug for hash_map::{Entry, VacantEntry, OccupiedEntry}ggomez-0/+33
2016-07-16Revert "Refactored code to access TLS only in case of panic"Tim Neumann-11/+9