summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-04-27auto merge of #13792 : jacob-hegna/rust/master, r=alexcrichtonbors-10/+28
Just modified the documentation for parse_bytes to make it more clear how the bytes were parsed (big endian) and to show an example of what it returned. I also added documentation for the to_str_bytes which previously had no documentation (besides one stackoverflow post).
2014-04-27Rewrote documentation for parse_bytes and to_str_bytes in {int, uint}_macros.rsJacob Hegna-10/+28
2014-04-27Fixed typo in std::iterAdolfo Ochagavía-1/+1
2014-04-27Added missing values in std::io::standard_error()m-r-r-1/+15
2014-04-26Fixing permutation of small lists, such that [], [x] -> [[]], [[x]], and ↵Wendell Smith-7/+48
updating size_hints. Fixes #13734 and #13759.
2014-04-26std: Add experimental networking methodsAlex Crichton-1/+70
The underlying I/O objects implement a good deal of various options here and there for tuning network sockets and how they perform. Most of this is a relic of "whatever libuv provides", but these options are genuinely useful. It is unclear at this time whether these options should be well supported or not, or whether they have correct names or not. For now, I believe it's better to expose the functionality than to not, but all new methods are added with an #[experimental] annotation.
2014-04-25clarify docs for std:io::fs::Path::{is_dir,is_file,exists}; add lstatAaron Turon-28/+28
Clarifies the interaction of `is_dir`, `is_file` and `exists` with symbolic links. Adds a convenience `lstat` function alongside of `stat`. Removes references to conditions. Closes issue #12583.
2014-04-25auto merge of #13735 : aturon/rust/float-consts-take-2, r=brsonbors-19/+40
Follow-up on issue #13297 and PR #13710. Instead of following the (confusing) C/C++ approach of using `MIN_VALUE` for the smallest *positive* number, we introduce `MIN_POS_VALUE` (and in the Float trait, `min_pos_value`) to represent this number. This patch also removes a few remaining redundantly-defined constants that were missed last time around.
2014-04-24auto merge of #13697 : pongad/rust/consts, r=alexcrichtonbors-172/+130
I decided to put architecture constants in another mod. They are not used, so a part of me is thinking of just getting rid of them altogether. The rest should be similar to what @brson wants. Fixes #13536
2014-04-25Cleaned up os::consts. The module only exposes constants for the target OS ↵Michael Darakananda-172/+130
and arch. Constants for other OS's and arch's must be defined manually. [breaking-change]
2014-04-24auto merge of #13723 : alexcrichton/rust/pipe-connect-timeout, r=brsonbors-2/+93
This adds support for connecting to a unix socket with a timeout (a named pipe on windows), and accepting a connection with a timeout. The goal is to bring unix pipes/named sockets back in line with TCP support for timeouts. Similarly to the TCP sockets, all methods are marked #[experimental] due to uncertainty about the type of the timeout argument. This internally involved a good bit of refactoring to share as much code as possible between TCP servers and pipe servers, but the core implementation did not change drastically as part of this commit. cc #13523
2014-04-24auto merge of #13711 : alexcrichton/rust/snapshots, r=brsonbors-2/+0
These are the first successful snapshots after the LLVM upgrade, built with LLVM that requires C++11
2014-04-24add min_pos_value constant for floatsAaron Turon-19/+40
Follow-up on issue #13297 and PR #13710. Instead of following the (confusing) C/C++ approach of using `MIN_VALUE` for the smallest *positive* number, we introduce `MIN_POS_VALUE` (and in the Float trait, `min_pos_value`) to represent this number. This patch also removes a few remaining redundantly-defined constants that were missed last time around.
2014-04-24std: Add timeouts to unix connect/acceptAlex Crichton-2/+93
This adds support for connecting to a unix socket with a timeout (a named pipe on windows), and accepting a connection with a timeout. The goal is to bring unix pipes/named sockets back in line with TCP support for timeouts. Similarly to the TCP sockets, all methods are marked #[experimental] due to uncertainty about the type of the timeout argument. This internally involved a good bit of refactoring to share as much code as possible between TCP servers and pipe servers, but the core implementation did not change drastically as part of this commit. cc #13523
2014-04-24auto merge of #13720 : aturon/rust/walk_dir-perf, r=alexcrichtonbors-2/+29
The `walk_dir` iterator was simulating a queue using a vector (in particular, using `shift`), leading to O(n^2) performance. Since the order was not well-specified (see issue #13411), the simplest fix is to use the vector as a stack (and thus yield a depth-first traversal). This patch does exactly that, and adds a test checking for depth-first behavior. Note that the underlying `readdir` function does not specify any particular order, nor does the system call it uses. Closes #13411.
2014-04-24fix O(n^2) perf bug for std::io::fs::walk_dirAaron Turon-2/+29
The `walk_dir` iterator was simulating a queue using a vector (in particular, using `shift`), leading to O(n^2) performance. Since the order was not well-specified (see issue #13411), the simplest fix is to use the vector as a stack (and thus yield a depth-first traversal). This patch does exactly that. It leaves the order as originally specified -- "some top-down order" -- and adds a test to ensure a top-down traversal. Note that the underlying `readdir` function does not specify any particular order, nor does the system call it uses. Closes #13411.
2014-04-24Update libuvAlex Crichton-2/+2
This update brings a few months of changes, but primarily a fix for the following situation. When creating a handle to stdin, libuv used to set the stdin handle to nonblocking mode. This would end up affect this stdin handle across all processes that shared it, which mean that stdin become nonblocking for everyone using the same stdin. On linux, this also affected *stdout* because stdin/stdout roughly point at the same thing. This problem became apparent when running the test suite manually on a local computer. The stdtest suite (running with libgreen) would set stdout to nonblocking mode (as described above), and then the next test suite would always fail for a printing failure (because stdout was returning EAGAIN). This has been fixed upstream, joyent/libuv@342e8c, and this update pulls in this fix. This also brings us in line with a recently upstreamed libuv patch. Closes #13336 Closes #13355
2014-04-24auto merge of #13710 : aturon/rust/float-constants, r=brsonbors-75/+94
Some of the constant values in std::f32 were incorrectly copied from std::f64. More broadly, both modules defined their constants redundantly in two places, which is what led to the bug. Moreover, the specs for some of the constants were incorrect, even when the values were correct. Closes #13297. Closes #11537.
2014-04-23auto merge of #13675 : sfackler/rust/taskbuilder-new, r=alexcrichtonbors-34/+27
The constructor for `TaskBuilder` is being changed to an associated function called `new` for consistency with the rest of the standard library. Closes #13666 [breaking-change]
2014-04-23Move task::task() to TaskBuilder::new()Steven Fackler-34/+27
The constructor for `TaskBuilder` is being changed to an associated function called `new` for consistency with the rest of the standard library. Closes #13666 [breaking-change]
2014-04-23auto merge of #13688 : alexcrichton/rust/accept-timeout, r=brsonbors-1/+86
This adds experimental support for timeouts when accepting sockets through `TcpAcceptor::accept`. This does not add a separate `accept_timeout` function, but rather it adds a `set_timeout` function instead. This second function is intended to be used as a hard deadline after which all accepts will never block and fail immediately. This idea was derived from Go's SetDeadline() methods. We do not currently have a robust time abstraction in the standard library, so I opted to have the argument be a relative time in millseconds into the future. I believe a more appropriate argument type is an absolute time, but this concept does not exist yet (this is also why the function is marked #[experimental]). The native support is built on select(), similarly to connect_timeout(), and the green support is based on channel select and a timer. cc #13523
2014-04-23std: Add support for an accept() timeoutAlex Crichton-1/+86
This adds experimental support for timeouts when accepting sockets through `TcpAcceptor::accept`. This does not add a separate `accept_timeout` function, but rather it adds a `set_timeout` function instead. This second function is intended to be used as a hard deadline after which all accepts will never block and fail immediately. This idea was derived from Go's SetDeadline() methods. We do not currently have a robust time abstraction in the standard library, so I opted to have the argument be a relative time in millseconds into the future. I believe a more appropriate argument type is an absolute time, but this concept does not exist yet (this is also why the function is marked #[experimental]). The native support is built on select(), similarly to connect_timeout(), and the green support is based on channel select and a timer. cc #13523
2014-04-23Register new snapshotsAlex Crichton-2/+0
These are the first successful snapshots after the LLVM upgrade, built with LLVM that requires C++11
2014-04-23auto merge of #13705 : edwardw/rust/rcboxptr-doc, r=alexcrichtonbors-1/+1
It is for internal use only and should not appear in docs.
2014-04-23fix std::f32 and std::f64 constantsAaron Turon-75/+94
Some of the constant values in std::f32 were incorrectly copied from std::f64. More broadly, both modules defined their constants redundantly in two places, which is what led to the bug. Moreover, the specs for some of the constants were incorrent, even when the values were correct. Closes #13297. Closes #11537.
2014-04-23auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakisbors-95/+109
This alters the borrow checker's requirements on invoking closures from requiring an immutable borrow to requiring a unique immutable borrow. This means that it is illegal to invoke a closure through a `&` pointer because there is no guarantee that is not aliased. This does not mean that a closure is required to be in a mutable location, but rather a location which can be proven to be unique (often through a mutable pointer). For example, the following code is unsound and is no longer allowed: type Fn<'a> = ||:'a; fn call(f: |Fn|) { f(|| { f(|| {}) }); } fn main() { call(|a| { a(); }); } There is no replacement for this pattern. For all closures which are stored in structures, it was previously allowed to invoke the closure through `&self` but it now requires invocation through `&mut self`. The standard library has a good number of violations of this new rule, but the fixes will be separated into multiple breaking change commits. Closes #12224
2014-04-23Fix other bugs with new closure borrowingAlex Crichton-22/+23
This fixes various issues throughout the standard distribution and tests.
2014-04-23std: Change Finally to take `&mut self`Alex Crichton-6/+6
As with the previous commits, the Finally trait is primarily implemented for closures, so the trait was modified from `&self` to `&mut self`. This will require that any closure variable invoked with `finally` to be stored in a mutable slot. [breaking-change]
2014-04-23std: Change CharEq to take `&mut self`Alex Crichton-50/+60
This is similar to the previous commits to allow invocation of a closure through a `&mut self` pointer because `&self` is disallowed. One of the primary implementors of the CharEq trait is a closure type, which would not work if the method continued to have `&self`. In addition to changing mutability of the `matches` method, this modifies the following methods from &CharEq to take a type which implements CharEq by value. * trim_chars * trim_left_chars * trim_right_chars Where these methods were previously invoked via s.trim_chars(&'a') it would now be invoked through s.trim_chars('a') [breaking-change]
2014-04-23std: Change RandomAccessIterator to use `&mut self`Alex Crichton-17/+20
Many iterators go through a closure when dealing with the `idx` method, which are invalid after the previous change (closures cannot be invoked through a `&` pointer). This commit alters the `fn idx` method on the RandomAccessIterator to take `&mut self` rather than `&self`. [breaking-change]
2014-04-23Hide trait rc::RcBoxPtr from docsEdward Wang-1/+1
It is for internal use only and should not appear in docs.
2014-04-23auto merge of #13694 : jacob-hegna/rust/master, r=brsonbors-0/+20
... and uint_macros.rs
2014-04-23auto merge of #13693 : thestinger/rust/mem, r=alexcrichtonbors-4/+27
This exposes volatile versions of the memset/memmove/memcpy intrinsics. The volatile parameter must be constant, so this can't simply be a parameter to our intrinsics.
2014-04-23auto merge of #13692 : vadimcn/rust/Win64-pre, r=alexcrichtonbors-18/+101
Stack unwinding doesn't work yet, so this won't pass a lot of tests.
2014-04-23auto merge of #13690 : alexcrichton/rust/unlink-unix-pipe, r=brsonbors-0/+16
This prevents unix sockets from remaining on the system all over the place, and more closely mirrors the behavior of libuv and windows pipes.
2014-04-23auto merge of #13687 : exscape/mut-vector-Show/master, r=alexcrichtonbors-0/+12
Removes the need for hacks to println! mutable slices, among other things.
2014-04-22auto merge of #13597 : bjz/rust/float-api, r=brsonbors-430/+524
This pull request: - Merges the `Round` trait into the `Float` trait, continuing issue #10387. - Has floating point functions take their parameters by value. - Cleans up the formatting and organisation in the definition and implementations of the `Float` trait. More information on the breaking changes can be found in the commit messages.
2014-04-22Fixed Win64 buildVadim Chugunov-18/+101
2014-04-22Removed trailing whitespace in on line 242 in int_macros.rs and on line 156 ↵Jacob Hegna-3/+3
in uint_macros.rs
2014-04-22add support for quadruple precision floating pointDaniel Micay-1/+15
This currently requires linking against a library like libquadmath (or libgcc), because compiler-rt barely has any support for this and most hardware does not yet have 128-bit precision floating point. For this reason, it's currently hidden behind a feature gate. When compiler-rt is updated to trunk, some tests can be added for constant evaluation since there will be support for the comparison operators. Closes #13381
2014-04-22Added examples for parse_bytes(buf: &[u8], radix: uint) in int_macros.rs and ↵Jacob Hegna-0/+20
uint_macros.rs
2014-04-22add volatile copy/copy_nonoverlapping/setDaniel Micay-4/+27
This exposes volatile versions of the memset/memmove/memcpy intrinsics. The volatile parameter must be constant, so this can't simply be a parameter to our intrinsics.
2014-04-22auto merge of #13674 : pcwalton/rust/more-str-inlines, r=alexcrichtonbors-0/+4
Was killing performance of selector matching in Servo. r? @alexcrichton (or anyone)
2014-04-22native: Unlink unix socket paths on dropAlex Crichton-0/+16
This prevents unix sockets from remaining on the system all over the place, and more closely mirrors the behavior of libuv and windows pipes.
2014-04-22auto merge of #13651 : ryantm/rust/master, r=brsonbors-3/+2
2014-04-22Implement Show for &mut [T]Thomas Backman-0/+12
2014-04-21str: Inline `only_ascii` in string iterators.Patrick Walton-0/+4
Was killing performance of selector matching in Servo.
2014-04-21Fix misspellings in comments.Joseph Crail-15/+15
2014-04-20fix copyright message based on `make check`Ryan Mulligan-3/+3
2014-04-20remove meaningless sentence and update copyright.Ryan Mulligan-5/+4