about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-10-24Move as much I/O as possible off of native::ioAlex Crichton-100/+160
When uv's TTY I/O is used for the stdio streams, the file descriptors are put into a non-blocking mode. This means that other concurrent writes to the same stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we avoid this error. There is one location which cannot move, which is the runtime's dumb_println function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and simply retry again and again.
2013-10-24Migrate the last typedefs to ~Trait in rtioAlex Crichton-19/+14
There are no longer any remnants of typedefs, and everything is now built on true trait objects.
2013-10-24Don't attempt to export uv functions directlyAlex Crichton-45/+47
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-315/+303
This involved changing a fair amount of code, rooted in how we access the local IoFactory instance. I added a helper method to the rtio module to access the optional local IoFactory. This is different than before in which it was assumed that a local IoFactory was *always* present. Now, a separate io_error is raised when an IoFactory is not present, yet I/O is requested.
2013-10-24Remove rt::io::supportAlex Crichton-208/+131
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-99/+92
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-24Cleaned, documented, wrote tests for up std::boolMarvin Löbel-302/+347
Removed unused import warning in std::mem and cleaned it up too Removed is_true and is_false from std::bool Removed freestanding functions in std::bool
2013-10-23mark some functions as returning !Daniel Micay-3/+2
Closes #10023
2013-10-23auto merge of #10032 : thestinger/rust/snapshot, r=huonwbors-9/+1
2013-10-23register snapshotsDaniel Micay-9/+1
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-452/+1043
2013-10-23auto merge of #9810 : huonw/rust/rand3, r=alexcrichtonbors-234/+825
- 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-22auto merge of #10015 : huonw/rust/minor-fixes, r=alexcrichtonbors-70/+78
- Use ["nothing up my sleeve numbers"](http://en.wikipedia.org/wiki/Nothing_up_my_sleeve_number) for the ISAAC tests. - Replace the default implementation of `Rng.fill_bytes` with something that doesn't try to do bad things with `transmute` and vectors just for the sake of a little speed. - Replace the transmutes used to seed the ISAAC RNGs with calls into `vec::raw`.
2013-10-22Remove thread-blocking call to `libc::stat` in `Path::stat`Ziad Hatahet-306/+54
Fixes #9958
2013-10-23std::rand: seed ISAAC with no transmutes.Huon Wilson-7/+16
Slice transmutes are now (and, really, always were) dangerous, so we avoid them and do the (only?) non-(undefined behaviour in C) pointer cast: casting to *u8.
2013-10-23std::rand: use "nothing up your sleeve numbers" for ISAAC tests.Huon Wilson-18/+18
There's no value in using the "random" numbers, when nothing up your sleeve numbers are perfectly serviceable. http://en.wikipedia.org/wiki/Nothing_up_my_sleeve_number
2013-10-23std::rand: simplify/safe-ify the default Rng.fill_bytes.Huon Wilson-45/+44
The `&[u8]` -> `&[u64]` and `&[u32]` casts were not nice: they ignored alignment requirements and are generally very unsafe.
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: move Weighted to distributions.Huon Wilson-132/+207
A user constructs the WeightedChoice distribution and then samples from it, which allows it to use binary search internally.
2013-10-23std::rand: lengthen the RNG benchmarks.Huon Wilson-8/+20
This makes them more representative, as the `bh.iter` is a smaller percentage of the total time.
2013-10-23std::rand: optimise & document ziggurat.Huon Wilson-8/+72
Before: test rand::distributions::bench::rand_exp ... bench: 1399 ns/iter (+/- 124) = 571 MB/s test rand::distributions::bench::rand_normal ... bench: 1611 ns/iter (+/- 123) = 496 MB/s After: test rand::distributions::bench::rand_exp ... bench: 712 ns/iter (+/- 43) = 1123 MB/s test rand::distributions::bench::rand_normal ... bench: 1007 ns/iter (+/- 81) = 794 MB/s
2013-10-23std::rand: documentation & references.Huon Wilson-44/+100
Most importantly, links to the papers/references for the core algorithms (the RNG ones & the distribution ones).
2013-10-23std::rand: add distributions::Range for generating [lo, hi).Huon Wilson-39/+274
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-23std::rand: full exponential & normal distributionsHuon Wilson-20/+116
Complete the implementation of Exp and Normal started by Exp1 and StandardNormal by creating types implementing Sample & IndependentSample with the appropriate parameters.
2013-10-23std::rand: Add RandSample for Sample-ing Rand types directly.Huon Wilson-0/+35
2013-10-23std::rand: add the Sample and IndependentSample traits.Huon Wilson-0/+18
These are a "parameterised" Rand.
2013-10-22Tidy up asm! usage in libstdAlex Crichton-11/+7
2013-10-23Making ai_next field publicreedlepee-1/+1
2013-10-23Removed the file src/libstd/unstable/extfmt.rreedlepee-703/+0
2013-10-23Removed the unnecesary commentsreedlepee-1/+0
2013-10-23Removed unnecessary comments and white spaces as suggestedreedlepee-49/+21
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-422/+217
2013-10-23Making fields in std and extra : private #4386reedlepee-354/+1286
2013-10-23Don't Make str field privatereedlepee-0/+1
2013-10-22Minor grammatical fixes and removed section on 'rust' toolMichael Letterle-2/+2
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-321/+321
Who doesn't like a massive renaming?
2013-10-22auto merge of #10009 : LeoTestard/rust/asm-feature-gated, r=huonwbors-1/+1
Suite of #9991
2013-10-22Activate checking code for ASM feature gate. Fix testsLéo Testard-1/+1
2013-10-21auto merge of #9937 : brson/rust/log_str, r=alexcrichtonbors-18/+13
2013-10-21auto merge of #9936 : madjar/rust/master, r=alexcrichtonbors-6/+0
This should close #9468. I removed the test stating that nested comments should not be implemented. I had a little chicken-and-egg problem because a comment of the std contains "/*", and adding support for nested comment creates a backward incompatibility in that case, so I had to use a dirty hack to get stage1 and stage2 to compile. This part should be revert when this commit lands in a snapshot. This is my first non-typo contribution, so I'm open to any comment.
2013-10-21auto merge of #10000 : cmr/rust/snapshot, r=alexcrichtonbors-3/+0
2013-10-21Add support for nested commentsGeorges Dubus-6/+0
Fixes #9468.
2013-10-21std: Move sys::log_str to repr::repr_to_str. Further work on #2240.Brian Anderson-18/+13