about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2014-05-07std: Add I/O timeouts to networking objectsAlex Crichton-15/+419
These timeouts all follow the same pattern as established by the timeouts on acceptors. There are three methods: set_timeout, set_read_timeout, and set_write_timeout. Each of these sets a point in the future after which operations will time out. Timeouts with cloned objects are a little trickier. Each object is viewed as having its own timeout, unaffected by other objects' timeouts. Additionally, timeouts do not propagate when a stream is cloned or when a cloned stream has its timeouts modified. This commit is just the public interface which will be exposed for timeouts, the implementation will come in later commits.
2014-05-07auto merge of #13964 : alexcrichton/rust/more-buffers, r=brsonbors-1/+63
This will allow methods like read_line() on RefReader, LimitReader, etc.
2014-05-07auto merge of #13751 : alexcrichton/rust/io-close-read, r=brsonbors-98/+534
Two new methods were added to TcpStream and UnixStream: fn close_read(&mut self) -> IoResult<()>; fn close_write(&mut self) -> IoResult<()>; These two methods map to shutdown()'s behavior (the system call on unix), closing the reading or writing half of a duplex stream. These methods are primarily added to allow waking up a pending read in another task. By closing the reading half of a connection, all pending readers will be woken up and will return with EndOfFile. The close_write() method was added for symmetry with close_read(), and I imagine that it will be quite useful at some point. Implementation-wise, librustuv got the short end of the stick this time. The native versions just delegate to the shutdown() syscall (easy). The uv versions can leverage uv_shutdown() for tcp/unix streams, but only for closing the writing half. Closing the reading half is done through some careful dancing to wake up a pending reader. As usual, windows likes to be different from unix. The windows implementation uses shutdown() for sockets, but shutdown() is not available for named pipes. Instead, CancelIoEx was used with same fancy synchronization to make sure everyone knows what's up. cc #11165
2014-05-07std: Add close_{read,write}() methods to I/OAlex Crichton-98/+534
Two new methods were added to TcpStream and UnixStream: fn close_read(&mut self) -> IoResult<()>; fn close_write(&mut self) -> IoResult<()>; These two methods map to shutdown()'s behavior (the system call on unix), closing the reading or writing half of a duplex stream. These methods are primarily added to allow waking up a pending read in another task. By closing the reading half of a connection, all pending readers will be woken up and will return with EndOfFile. The close_write() method was added for symmetry with close_read(), and I imagine that it will be quite useful at some point. Implementation-wise, librustuv got the short end of the stick this time. The native versions just delegate to the shutdown() syscall (easy). The uv versions can leverage uv_shutdown() for tcp/unix streams, but only for closing the writing half. Closing the reading half is done through some careful dancing to wake up a pending reader. As usual, windows likes to be different from unix. The windows implementation uses shutdown() for sockets, but shutdown() is not available for named pipes. Instead, CancelIoEx was used with same fancy synchronization to make sure everyone knows what's up. cc #11165
2014-05-07auto merge of #14005 : alexcrichton/rust/extern-unsafe, r=pcwaltonbors-49/+59
Previously, the parser would not allow you to simultaneously implement a function with a different abi as well as being unsafe at the same time. This extends the parser to allow functions of the form: unsafe extern fn foo() { // ... } The closure type grammar was also changed to reflect this reversal, types previously written as "extern unsafe fn()" must now be written as "unsafe extern fn()". The parser currently has a hack which allows the old style, but this will go away once a snapshot has landed. Closes #10025 [breaking-change]
2014-05-07auto merge of #13726 : michaelwoerister/rust/lldb-autotests, r=alexcrichtonbors-3371/+3697
This pull request contains preparations for adding LLDB autotests: + the debuginfo tests are split into debuginfo-gdb and debuginfo-lldb + the `compiletest` tool is updated to support the debuginfo-lldb mode + tests.mk is modified to provide debuginfo-gdb and debuginfo-lldb make targets + GDB test cases are moved from `src/test/debug-info` to `src/test/debuginfo-gdb` + configure will now look for LLDB and set the appropriate CFG variables + the `lldb_batchmode.py` script is added to `src/etc`. It emulates GDB's batch mode The LLDB autotests themselves are not part of this PR. Those will probable require some manual work on the test bots to make them work for the first time. Better to get these unproblematic preliminaries out of the way in a separate step.
2014-05-07auto merge of #13901 : alexcrichton/rust/facade, r=brsonbors-12764/+14008
This is the second step in implementing #13851. This PR cannot currently land until a snapshot exists with #13892, but I imagine that this review will take longer. This PR refactors a large amount of functionality outside of the standard library into a new library, libcore. This new library has 0 dependencies (in theory). In practice, this library currently depends on these symbols being available: * `rust_begin_unwind` and `rust_fail_bounds_check` - These are the two entry points of failure in libcore. The symbols are provided by libstd currently. In the future (see the bullets on #13851) this will be officially supported with nice error mesages. Additionally, there will only be one failure entry point once `std::fmt` migrates to libcore. * `memcpy` - This is often generated by LLVM. This is also quite trivial to implement for any platform, so I'm not too worried about this. * `memcmp` - This is required for comparing strings. This function is quite common *everywhere*, so I don't feel to bad about relying on a consumer of libcore to define it. * `malloc` and `free` - This is quite unfortunate, and is a temporary stopgap until we deal with the `~` situation. More details can be found in the module `core::should_not_exist` * `fmod` and `fmodf` - These exist because the `Rem` trait is defined in libcore, so the `Rem` implementation for floats must also be defined in libcore. I imagine that any platform using floating-point modulus will have these symbols anyway, and otherwise they will be optimized out. * `fdim` and `fdimf` - Like `fmod`, these are from the `Signed` trait being defined in libcore. I don't expect this to be much of a problem These dependencies all "Just Work" for now because libcore only exists as an rlib, not as a dylib. The commits themselves are organized to show that the overall diff of this extraction is not all that large. Most modules were able to be moved with very few modifications. The primary module left out of this iteration is `std::fmt`. I plan on migrating the `fmt` module to libcore, but I chose to not do so at this time because it had implications on the `Writer` trait that I wanted to deal with in isolation. There are a few breaking changes in these commits, but they are fairly minor, and are all labeled with `[breaking-change]`. The nastiest parts of this movement come up with `~[T]` and `~str` being language-defined types today. I believe that much of this nastiness will get better over time as we migrate towards `Vec<T>` and `Str` (or whatever the types will be named). There will likely always be some extension traits, but the situation won't be as bad as it is today. Known deficiencies: * rustdoc will get worse in terms of readability. This is the next issue I will tackle as part of #13851. If others think that the rustdoc change should happen first, I can also table this to fix rustdoc first. * The compiler reveals that all these types are reexports via error messages like `core::option::Option`. This is filed as #13065, and I believe that issue would have a higher priority now. I do not currently plan on fixing that as part of #13851. If others believe that this issue should be fixed, I can also place it on the roadmap for #13851. I recommend viewing these changes on a commit-by-commit basis. The overall change is likely too overwhelming to take in.
2014-05-07Test fixes and rebase conflictsAlex Crichton-44/+39
2014-05-07debuginfo: Split debuginfo autotests into debuginfo-gdb and debuginfo-lldbMichael Woerister-3371/+3697
2014-05-07Register new snapshotsAlex Crichton-0/+8
This is the first snapshot with support to mix rlib and dylib dependencies.
2014-05-07core: Move Option::expect to libstd from libcoreAlex Crichton-33/+177
See #14008 for more details
2014-05-07core: Fix an unsigned negation warningAlex Crichton-1/+1
2014-05-07test: Update with std => core movementAlex Crichton-10/+10
2014-05-07core: Get coretest workingAlex Crichton-77/+238
This mostly involved frobbing imports between realstd, realcore, and the core being test. Some of the imports are a little counterintuitive, but it mainly focuses around libcore's types not implementing Show while libstd's types implement Show.
2014-05-07core: Inherit the cell moduleAlex Crichton-9/+5
2014-05-07core: Add unwrap()/unwrap_err() methods to ResultAlex Crichton-6/+327
These implementations must live in libstd right now because the fmt module has not been migrated yet. This will occur in a later PR. Just to be clear, there are new extension traits, but they are not necessary once the std::fmt module has migrated to libcore, which is a planned migration in the future.
2014-05-07core: Inherit the result moduleAlex Crichton-31/+22
The unwrap()/unwrap_err() methods are temporarily removed, and will be added back in the next commit.
2014-05-07core: Remove generics from Option::expectAlex Crichton-3/+1
The prospects of a generic failure function such as this existing in libcore are bleak, due to monomorphization not working across the crate boundary, and allocation into a ~Any is not allowed in libcore. The argument to expect() is now &str instead of <M: Send + Any> [breaking-change]
2014-05-07core: Add a limited implementation of failureAlex Crichton-77/+155
This adds an small of failure to libcore, hamstrung by the fact that std::fmt hasn't been migrated yet. A few asserts were re-worked to not use std::fmt features, but these asserts can go back to their original form once std::fmt has migrated. The current failure implementation is to just have some symbols exposed by std::rt::unwind that are linked against by libcore. This is an explicit circular dependency, unfortunately. This will be officially supported in the future through compiler support with much nicer failure messages. Additionally, there are two depended-upon symbols today, but in the future there will only be one (once std::fmt has migrated).
2014-05-07core: Bring char/finally test style up to dateAlex Crichton-196/+202
2014-05-07core: Allow some #[deriving] in libcoreAlex Crichton-0/+6
2014-05-07core: Implement necessary traits for ~[T]/~strAlex Crichton-0/+200
Coherence requires that libcore's traits be implemented in libcore for ~[T] and ~str (due to them being language defined types). These implementations cannot live in libcore forever, but for now, until Heap/Box/Uniq is a lang item, these implementations must reside inside of libcore. While not perfect implementations, these shouldn't reside in libcore for too long. With some form of lang item these implementations can be in a proper crate because the lang item will not be present in libcore.
2014-05-07std: Remove a glob to get std to compileAlex Crichton-1/+1
2014-05-07core: Inherit possible string functionalityAlex Crichton-1950/+1984
This moves as much allocation as possible from teh std::str module into core::str. This includes essentially all non-allocating functionality, mostly iterators and slicing and such. This primarily splits the Str trait into only having the as_slice() method, adding a new StrAllocating trait to std::str which contains the relevant new allocation methods. This is a breaking change if any of the methods of "trait Str" were overriden. The old functionality can be restored by implementing both the Str and StrAllocating traits. [breaking-change]
2014-05-07core: Inherit necessary unicode functionalityAlex Crichton-4991/+5011
The unicode module remains private, but the normalization iterators require an allocation, so some functionality needs to remain in libstd
2014-05-07core: Inherit non-allocating slice functionalityAlex Crichton-1555/+1537
This commit adds a new trait, MutableVectorAllocating, which represents functions on vectors which can allocate. This is another extension trait to slices which should be removed once a lang item exists for the ~ allocation.
2014-05-07core: Inherit the specific numeric modulesAlex Crichton-1506/+1825
This implements all traits inside of core::num for all the primitive types, removing all the functionality from libstd. The std modules reexport all of the necessary items from the core modules.
2014-05-07core: Inherit what's possible from the num moduleAlex Crichton-849/+877
This strips out all string-related functionality from the num module. The inherited functionality is all that will be implemented in libcore (for now). Primarily, libcore will not implement the Float trait or any string-related functionality. It may be possible to migrate string parsing functionality into libcore in the future, but for now it will remain in libstd. All functionality in core::num is reexported in std::num.
2014-05-07core: Inhert ~/@/& cmp traits, remove old modulesAlex Crichton-150/+76
This commit removes the std::{managed, reference} modules. The modules serve essentially no purpose, and the only free function removed was `managed::ptr_eq` which can be achieved by comparing references. [breaking-change]
2014-05-07core: Inherit the cmp moduleAlex Crichton-57/+15
This removes the TotalOrd and TotalEq implementation macros, they will be added later to the numeric modules (where the other comparison implementations live).
2014-05-07core: Inherit the iter moduleAlex Crichton-2/+17
2014-05-07core: Inherit the option moduleAlex Crichton-3/+12
2014-05-07core: Inherit the bool moduleAlex Crichton-36/+41
2014-05-07core: Inherit the tuple moduleAlex Crichton-21/+32
2014-05-07core: Bring clone tests up to date in styleAlex Crichton-36/+39
2014-05-07core: Inherit the clone moduleAlex Crichton-1/+2
2014-05-07core: Inherit the unit moduleAlex Crichton-8/+7
2014-05-07core: Inherit the default moduleAlex Crichton-0/+2
2014-05-07core: Inherit the raw moduleAlex Crichton-2/+3
2014-05-07core: Inherit the any moduleAlex Crichton-19/+10
2014-05-07core: Inherit the finally moduleAlex Crichton-1/+9
2014-05-07core: Inherit the char moduleAlex Crichton-3/+16
2014-05-07core: Inherit the container moduleAlex Crichton-1/+2
2014-05-07core: Inherit the ty moduleAlex Crichton-2/+2
2014-05-07core: Inherit the ops moduleAlex Crichton-1/+2
2014-05-07core: Inherit the kinds moduleAlex Crichton-1/+6
2014-05-07core: Inherit the cast moduleAlex Crichton-1/+2
2014-05-07core: Inherit the ptr moduleAlex Crichton-45/+11
2014-05-07core: Inherit the mem moduleAlex Crichton-4/+2
2014-05-07core: Inherit the intrinsics moduleAlex Crichton-4/+25