about summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
2013-10-24Remove rt::io::supportAlex Crichton-158/+83
This removes the PathLike trait associated with this "support module". This is yet another "container of bytes" trait, so I didn't want to duplicate what already exists throughout libstd. In actuality, we're going to pass of C strings to the libuv APIs, so instead the arguments are now bound with the 'ToCStr' trait instead. Additionally, a layer of complexity was removed by immediately converting these type-generic parameters into CStrings to get handed off to libuv apis.
2013-10-24Migrate Rtio objects to true trait objectsAlex Crichton-97/+90
This moves as many as I could over to ~Trait instead of ~Typedef. The only remaining one is the IoFactoryObject which should be coming soon...
2013-10-24Move rt::io::stdio from FileStream to a TTYAlex Crichton-162/+303
We get a little more functionality from libuv for these kinds of streams (things like terminal dimentions), and it also appears to more gracefully handle the stream being a window. Beforehand, if you used stdio and hit CTRL+d on a process, libuv would continually return 0-length successful reads instead of interpreting that the stream was closed. I was hoping to be able to write tests for this, but currently the testing infrastructure doesn't allow tests with a stdin and a stdout, but this has been manually tested! (not that it means much)
2013-10-24Remove unbound pipes from io::pipeAlex Crichton-41/+22
This isn't necessary for creating processes (or at least not right now), and it inherently attempts to expose implementation details.
2013-10-24Address a few XXX comments throughout the runtimeAlex Crichton-12/+20
* Implement Seek for Option<Seek> * Remove outdated comment for io::process * De-pub a component which didn't need to be pub
2013-10-24Finish implementing io::net::addrinfoAlex Crichton-92/+249
This fills in the `hints` structure and exposes libuv's full functionality for doing dns lookups.
2013-10-24Implement io::net::unixAlex Crichton-86/+587
2013-10-23mark some functions as returning !Daniel Micay-1/+1
Closes #10023
2013-10-23Made uv_stat_t.{st_dev, st_ino} public, #9958Ziad Hatahet-2/+2
2013-10-23Merge remote-tracking branch 'upstream/master'Ziad Hatahet-114/+110
2013-10-23auto merge of #9810 : huonw/rust/rand3, r=alexcrichtonbors-2/+2
- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference). - Adds proper `Normal` and `Exp`-onential distributions - Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself) - Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it - optimisations and docs
2013-10-23auto merge of #10021 : alexcrichton/rust/asm-now-analyzed-correctly, r=luqmanabors-11/+7
We got a snapshot, taking care of a note to myself.
2013-10-22Remove thread-blocking call to `libc::stat` in `Path::stat`Ziad Hatahet-2/+11
Fixes #9958
2013-10-22auto merge of #10020 : mletterle/rust/documentation-fixes, r=thestingerbors-2/+2
I'm planning on doing more updates, but the section in the tutorial stood out at me since the 'rust' tool no longer exists, this should probably be removed to lessen confusion.
2013-10-23std::rand: add distributions::Range for generating [lo, hi).Huon Wilson-2/+2
This reifies the computations required for uniformity done by (the old) `Rng.gen_integer_range` (now Rng.gen_range), so that they can be amortised over many invocations, if it is called in a loop. Also, it makes it correct, but using a trait + impls for each type, rather than trying to coerce `Int` + `u64` to do the right thing. This also makes it more extensible, e.g. big integers could & should implement SampleRange.
2013-10-22Tidy up asm! usage in libstdAlex Crichton-11/+7
2013-10-23Making ai_next field publicreedlepee-1/+1
2013-10-23Removed unnecessary comments and white spaces as suggestedreedlepee-14/+14
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-112/+25
2013-10-23Making fields in std and extra : private #4386reedlepee-127/+214
2013-10-22Minor grammatical fixes and removed section on 'rust' toolMichael Letterle-2/+2
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-103/+103
Who doesn't like a massive renaming?
2013-10-20Don't allocate a string when calling printlnAlex Crichton-1/+18
Instead use format_args! to pass around a struct to pass along into std::fmt
2013-10-19auto merge of #9834 : alexcrichton/rust/morestack, r=brsonbors-67/+412
This commit re-introduces the functionality of __morestack in a way that it was not originally anticipated. Rust does not currently have segmented stacks, rather just large stack segments. We do not detect when these stack segments are overrun currently, but this commit leverages __morestack in order to check this. This commit purges a lot of the old __morestack and stack limit C++ functionality, migrating the necessary chunks to rust. The stack limit is now entirely maintained in rust, and the "main logic bits" of __morestack are now also implemented in rust as well. I put my best effort into validating that this currently builds and runs successfully on osx and linux 32/64 bit, but I was unable to get this working on windows. We never did have unwinding through __morestack frames, and although I tried poking at it for a bit, I was unable to understand why we don't get unwinding right now. A focus of this commit is to implement as much of the logic in rust as possible. This involved some liberal usage of `no_split_stack` in various locations, along with some use of the `asm!` macro (scary). I modified a bit of C++ to stop calling `record_sp_limit` because this is no longer defined in C++, rather in rust. Another consequence of this commit is that `thread_local_storage::{get, set}` must both be flagged with `#[rust_stack]`. I've briefly looked at the implementations on osx/linux/windows to ensure that they're pretty small stacks, and I'm pretty sure that they're definitely less than 20K stacks, so we probably don't have a lot to worry about. Other things worthy of note: * The default stack size is now 4MB instead of 2MB. This is so that when we request 2MB to call a C function you don't immediately overflow because you have consumed any stack at all. * `asm!` is actually pretty cool, maybe we could actually define context switching with it? * I wanted to add links to the internet about all this jazz of storing information in TLS, but I was only able to find a link for the windows implementation. Otherwise my suggestion is just "disassemble on that arch and see what happens" * I put my best effort forward on arm/mips to tweak __morestack correctly, we have no ability to test this so an extra set of eyes would be useful on these spots. * This is all really tricky stuff, so I tried to put as many comments as I thought were necessary, but if anything is still unclear (or I completely forgot to take something into account), I'm willing to write more!
2013-10-19Use __morestack to detect stack overflowAlex Crichton-67/+412
This commit resumes management of the stack boundaries and limits when switching between tasks. This additionally leverages the __morestack function to run code on "stack overflow". The current behavior is to abort the process, but this is probably not the best behavior in the long term (for deails, see the comment I wrote up in the stack exhaustion routine).
2013-10-18auto merge of #9926 : Kimundi/rust/future_result_bad_sig, r=huonwbors-25/+0
2013-10-18Made `std::task::TaskBuilder::future_result()` easier to useMarvin Löbel-25/+0
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-7/+7
2013-10-16auto merge of #9721 : klutzy/rust/uv-net-read-fix, r=alexcrichtonbors-8/+38
See #9605 for detailed information. This also fixes two tests of #8811.
2013-10-16auto merge of #9655 : kballard/rust/path-rewrite, r=alexcrichtonbors-38/+47
Rewrite the entire `std::path` module from scratch. `PosixPath` is now based on `~[u8]`, which fixes #7225. Unnecessary allocation has been eliminated. There are a lot of clients of `Path` that still assume utf-8 paths. This is covered in #9639.
2013-10-15auto merge of #9857 : brson/rust/mainsched, r=alexcrichtonbors-2/+8
...al work This is causing really awful scheduler behavior where the main thread scheduler is continually waking up, stealing work, discovering it can't actually run the work, and sending it off to another scheduler. No test cases because we don't have suitable instrumentation for it.
2013-10-15path2: Adjust the API to remove all the _str mutation methodsKevin Ballard-27/+28
Add a new trait BytesContainer that is implemented for both byte vectors and strings. Convert Path::from_vec and ::from_str to one function, Path::new(). Remove all the _str-suffixed mutation methods (push, join, with_*, set_*) and modify the non-suffixed versions to use BytesContainer.
2013-10-15path2: Replace the path module outrightKevin Ballard-38/+46
Remove the old path. Rename path2 to path. Update all clients for the new path. Also make some miscellaneous changes to the Path APIs to help the adoption process.
2013-10-14std::rt: Fix the set up of the main thread so that it doesn't try to steal workBrian Anderson-2/+8
This is causing really awful scheduler behavior where the main thread scheduler is continually waking up, stealing work, discovering it can't actually run the work, and sending it off to another scheduler.
2013-10-14Remove unused abi attributes.Steve Klabnik-1/+0
They've been replaced by putting the name on the extern block. #[abi = "foo"] goes to extern "foo" { } Closes #9483.
2013-10-11auto merge of #9809 : fhahn/rust/remove-old-cratemap-code, r=alexcrichtonbors-170/+10
This patch removes the code responsible for handling older CrateMap versions (as discussed during #9593). Only the new (safer) layout is supported now.
2013-10-11Remove support for older CrateMap versionsFlorian Hahn-170/+10
2013-10-11De-pub some private runtime componentsAlex Crichton-28/+134
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
2013-10-10auto merge of #9749 : alexcrichton/rust/less-io, r=brsonbors-145/+1251
This implements a number of the baby steps needed to start eliminating everything inside of `std::io`. It turns out that there are a *lot* of users of that module, so I'm going to try to tackle them separately instead of bringing down the whole system all at once. This pull implements a large amount of unimplemented functionality inside of `std::rt::io` including: * Native file I/O (file descriptors, *FILE) * Native stdio (through the native file descriptors) * Native processes (extracted from `std::run`) I also found that there are a number of users of `std::io` which desire to read an input line-by-line, so I added an implementation of `read_until` and `read_line` to `BufferedReader`. With all of these changes in place, I started to axe various usages of `std::io`. There's a lot of one-off uses here-and-there, but the major use-case remaining that doesn't have a fantastic solution is `extra::json`. I ran into a few compiler bugs when attempting to remove that, so I figured I'd come back to it later instead. There is one fairly major change in this pull, and it's moving from native stdio to uv stdio via `print` and `println`. Unfortunately logging still goes through native I/O (via `dumb_println`). This is going to need some thinking, because I still want the goal of logging/printing to be 0 allocations, and this is not possible if `io::stdio::stderr()` is called on each log message. Instead I think that this may need to be cached as the `logger` field inside the `Task` struct, but that will require a little more workings to get right (this is also a similar problem for print/println, do we cache `stdout()` to not have to re-create it every time?).
2013-10-10Make the file::DirectoryInfo trait publicAlex Crichton-1/+1
This was just a mistake that it was hidden.
2013-10-10Remove some users of io::file_readerAlex Crichton-4/+24
2013-10-10Migrate users of io::fd_t to io::native::file::fd_tAlex Crichton-88/+34
2013-10-10Implement BufferedReader.{read_until, read_line}Alex Crichton-7/+65
These two functions will be useful when replacing various other counterparts used by std::io consumers.
2013-10-10Implement rt::io::stdioAlex Crichton-25/+83
Additionally, this moves the prelude imports of print/println from std::io to std::rt::io. Closes #6846
2013-10-09auto merge of #9780 : sfackler/rust/extensions2, r=alexcrichtonbors-1/+1
This works around #9779, but is probably the right thing to do anyways since that's the module where all of the documentation for those traits lives.
2013-10-09auto merge of #9742 : alexcrichton/rust/issue-9739, r=brsonbors-2/+8
This changes an `assert_once_ever!` assertion to just a plain old assertion around an atomic boolean to ensure that one particular runtime doesn't attempt to exit twice. Closes #9739
2013-10-09Don't abort if the runtime is run twice.Alex Crichton-2/+8
This changes an `assert_once_ever!` assertion to just a plain old assertion around an atomic boolean to ensure that one particular runtime doesn't attempt to exit twice. Closes #9739
2013-10-09Implement io::native::processAlex Crichton-0/+752
2013-10-09Implement io::native::stdioAlex Crichton-0/+67
2013-10-09Implement io::native::fileAlex Crichton-25/+230