about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-12-11Add std::io::utilSteven Fackler-0/+298
This adds a bunch of useful Reader and Writer implementations. I'm not a huge fan of the name `util` but I can't think of a better name and I don't want to make `std::io` any longer than it already is.
2013-12-10Implement PortReader and ChanWriterRaphael Speyer-11/+172
2013-12-09auto merge of #10840 : cmr/rust/any_docs2, r=huonwbors-1/+8
2013-12-09Add some Any docs.Corey Richardson-1/+8
2013-12-09auto merge of #10859 : huonw/rust/helper-dists, r=cmrbors-246/+568
This moves `std::rand::distribitions::{Normal, StandardNormal}` to `...::distributions::normal`, reexporting `Normal` from `distributions` (and similarly for `Exp` and Exp1`), and adds: - Log-normal - Chi-squared - F - Student T all of which are implemented in C++11's random library. Tests in https://github.com/huonw/random-tests/commit/0424b8aded5e608ae386c1f917934a726d9cac6a. Note that these are approximately half documentation & half implementation (of which a significant portion is boilerplate `}`'s and so on).
2013-12-08std::rand: implement the student t distribution.Huon Wilson-1/+52
2013-12-08std::rand: implement the F distribution.Huon Wilson-1/+60
2013-12-08std::rand: implement the chi-squared distribution.Huon Wilson-2/+99
2013-12-08Remove dead codesKiet Tran-165/+38
2013-12-07std::rand: implement the log-normal distribution.Huon Wilson-2/+58
2013-12-07std::rand: move normal and exponential to their own file.Huon Wilson-244/+303
2013-12-07auto merge of #10824 : huonw/rust/str-doc, r=alexcrichtonbors-42/+321
Fixes #10819.
2013-12-06auto merge of #10364 : Kimundi/rust/result_compose, r=alexcrichtonbors-125/+44
This implements parts of the changes to `Result` and `Option` I proposed and discussed in this thread: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006254.html This PR includes: - Adding `ok()` and `err()` option adapters for both `Result` variants. - Removing `get_ref`, `expect` and iterator constructors for `Result`, as they are reachable with the variant adapters. - Removing `Result`s `ToStr` bound on the error type because of composability issues. (See https://mail.mozilla.org/pipermail/rust-dev/2013-November/006283.html) - Some warning cleanups
2013-12-06Link rustllvm statically, and distribute a static snapshotAlex Crichton-0/+1
In order to keep up to date with changes to the libraries that `llvm-config` spits out, the dependencies to the LLVM are a dynamically generated rust file. This file is now automatically updated whenever LLVM is updated to get kept up-to-date. At the same time, this cleans out some old cruft which isn't necessary in the makefiles in terms of dependencies. Closes #10745 Closes #10744
2013-12-07std::str: Add examples to the StrSlice trait.Huon Wilson-42/+321
Fixes #10819.
2013-12-06Made Results API more composableMarvin Löbel-125/+44
2013-12-05auto merge of #10562 : ongardie/rust/master, r=brsonbors-6/+7
It's useful to allow users to get at the internal std::rc::comm::Port, and other such fields, since they implement important traits like Select. See [rust-dev] "select on std::comm::Port and different types" at https://mail.mozilla.org/pipermail/rust-dev/2013-November/006735.html for background.
2013-12-05auto merge of #10817 : alexcrichton/rust/sched-fix, r=brsonbors-4/+49
Right now, as pointed out in #8132, it is very easy to introduce a subtle race in the runtime. I believe that this is the cause of the current flakiness on the bots. I have taken the last idea mentioned in that issue which is to use a lock around descheduling and context switching in order to solve this race. Closes #8132
2013-12-05Solve some nasty deschedulinging races with a lockAlex Crichton-4/+49
Right now, as pointed out in #8132, it is very easy to introduce a subtle race in the runtime. I believe that this is the cause of the current flakiness on the bots. I have taken the last idea mentioned in that issue which is to use a lock around descheduling and context switching in order to solve this race. Closes #8132
2013-12-05Fix documentation typo (divison operator is not backslash)Alexandros Tasos-2/+2
2013-12-04auto merge of #10796 : kballard/rust/revert-new-naming, r=alexcrichtonbors-433/+432
Rename the `*::init()` functions back to `*::new()`, since `new` is not going to become a keyword.
2013-12-04Rename std::rt::deque::*::init() to *::new()Kevin Ballard-20/+20
2013-12-04Revert "libstd: Change `Path::new` to `Path::init`."Kevin Ballard-413/+412
This reverts commit c54427ddfbbab41a39d14f2b1dc4f080cbc2d41b. Leave the #[ignores] in that were added to rustpkg tests. Conflicts: src/librustc/driver/driver.rs src/librustc/metadata/creader.rs
2013-12-04auto merge of #10804 : alexcrichton/rust/less-dup, r=pcwaltonbors-13/+5
This is just an implementation detail of using libuv, so move the libuv-specific logic into librustuv.
2013-12-04auto merge of #10803 : vmx/rust/integer-decode, r=cmrbors-0/+60
The `integer_decode()` function decodes a float (f32/f64) into integers containing the mantissa, exponent and sign. It's needed for `rationalize()` implementation of #9838. The code got ported from ABCL [1]. [1] http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/FloatFunctions.java?rev=14465#L94 I got the permission to use this code for Rust from Peter Graves (the ABCL copyright holder) . If there's any further IP clearance needed, let me know.
2013-12-04Don't dup the stdio file descriptors.Alex Crichton-13/+5
This is just an implementation detail of using libuv, so move the libuv-specific logic into librustuv.
2013-12-04Decode a float into integersVolker Mische-0/+60
The `integer_decode()` function decodes a float (f32/f64) into integers containing the mantissa, exponent and sign. It's needed for `rationalize()` implementation of #9838. The code got ported from ABCL [1]. [1] http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/FloatFunctions.java?rev=14465#L94
2013-12-04std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.Huon Wilson-36/+36
2013-12-04std::str: remove from_utf8.Huon Wilson-140/+37
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-12-03Move std::util::ignore to std::prelude::dropSteven Fackler-12/+10
It's a more fitting name for the most common use case of this function.
2013-12-03auto merge of #10747 : alexcrichton/rust/snapshots, r=cmrbors-56/+2
This registers new snapshots after the landing of #10528, and then goes on to tweak the build process to build a monolithic `rustc` binary for use in future snapshots. This mainly involved dropping the dynamic dependency on `librustllvm`, so that's now built as a static library (with a dynamically generated rust file listing LLVM dependencies). This currently doesn't actually make the snapshot any smaller (24MB => 23MB), but I noticed that the executable has 11MB of metadata so once progress is made on #10740 we should have a much smaller snapshot. There's not really a super-compelling reason to distribute just a binary because we have all the infrastructure for dealing with a directory structure, but to me it seems "more correct" that a snapshot compiler is just a `rustc` binary.
2013-12-03Register new snapshotsAlex Crichton-56/+2
2013-12-03auto merge of #10768 : Blei/rust/logging-enabled-macros, r=alexcrichtonbors-5/+20
This is useful when the information that is needed to do useful logging is expensive to produce.
2013-12-03add MutableVector::mut_split(self, pred) -> DoubleEndedIterator<&mut [T]>Guillaume Pinot-4/+110
This method is the mutable version of ImmutableVector::split. It is a DoubleEndedIterator, making mut_rsplit irrelevent. The size_hint method is not optimal because of #9629. At the same time, clarify *split* iterator doc.
2013-12-02Add a macro to check if logging at a given label is enabledPhilipp Brüschweiler-5/+20
This is useful when the information that is needed to do useful logging is expensive to produce.
2013-12-02rename MutableVector::mut_split(at) to MutableVector::mut_split_at(at)Guillaume Pinot-6/+6
2013-12-01auto merge of #10756 : thestinger/rust/transmute, r=alexcrichtonbors-7/+1
2013-12-01remove useless `transmute_immut` functionDaniel Micay-7/+1
2013-11-30auto merge of #10739 : DaGenix/rust/mut-chunks, r=alexcrichtonbors-0/+102
mut_chunks() returns an iterator that produces mutable slices. This is the mutable version of the existing chunks() method on the ImmutableVector trait. EDIT: This uses only safe code now. PREVIOUSLY: I tried to get this working with safe code only, but I couldn't figure out how to make that work. Before #8624, the exact same code worked without the need for the transmute() call. With that fix and without the transmute() call, the compiler complains about the call to mut_slice(). I think the issue is that the mutable slice that is returned will live longer than the self parameter since the self parameter doesn't have an explicit lifetime. However, that is the way that the Iterator trait defines the next() method. I'm sure there is a good reason for that, although I don't quite understand why. Anyway, I think the interface is safe, since the MutChunkIter will only hand out non-overlapping pointers and there is no way to get it to hand out the same pointer twice.
2013-11-30auto merge of #10733 : alexcrichton/rust/ignore-on-windows, r=pcwaltonbors-0/+1
I've seen this fail on windows twice now, and it's not clear to me why it's failing. For now, ignore it on that platform while investigation enuses.
2013-11-30auto merge of #10738 : sfackler/rust/buffered-fixes, r=alexcrichtonbors-10/+28
BufferedWriter::inner flushes before returning the underlying writer. BufferedWriter::write no longer flushes the underlying writer. LineBufferedWriter::write flushes up to the *last* newline in the input string, not the first.
2013-11-30Implement DoubleEndedIterator for MutChunkIter.Palmer Cox-0/+29
2013-11-30Implement mut_chunks() method for MutableVector trait.Palmer Cox-0/+73
mut_chunks() returns an iterator that produces mutable slices. This is the mutable version of the existing chunks() method on the ImmutableVector trait.
2013-11-30auto merge of #10528 : alexcrichton/rust/static-linking-v2, r=pcwaltonbors-10/+59
In this series of commits, I've implemented static linking for rust. The scheme I implemented was the same as my [mailing list post](https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html). The commits have more details to the nitty gritty of what went on. I've rebased this on top of my native mutex pull request (#10479), but I imagine that it will land before this lands, I just wanted to pre-emptively get all the rebase conflicts out of the way (becuase this is reorganizing building librustrt as well). Some contentious points I want to make sure are all good: * I've added more "compiler chooses a default" behavior than I would like, I want to make sure that this is all very clearly outlined in the code, and if not I would like to remove behavior or make it clearer. * I want to make sure that the new "fancy suite" tests are ok (using make/python instead of another rust crate) If we do indeed pursue this, I would be more than willing to write up a document describing how linking in rust works. I believe that this behavior should be very understandable, and the compiler should never hinder someone just because linking is a little fuzzy.
2013-11-30Test fixes and merge conflictsAlex Crichton-0/+1
2013-11-30auto merge of #10737 : huonw/rust/with-cap, r=alexcrichtonbors-1/+7
This allows one to reduce the number of reallocs of the internal buffer if one has an approximate idea of the size of the final output.
2013-11-30Fixes for BufferedWriter and LineBufferedWriterSteven Fackler-10/+28
BufferedWriter::inner flushes before returning the underlying writer. BufferedWriter::write no longer flushes the underlying writer. LineBufferedWriter::write flushes up to the *last* newline in the input string, not the first.
2013-12-01std::io::mem: add a with_capacity constructor to MemWriter.Huon Wilson-1/+7
This allows one to reduce the number of reallocs of the internal buffer if one has an approximate idea of the size of the final output.
2013-11-30Wrap the return value of the type_id intrinsic in an opaque boxCorey Richardson-24/+32
Closes #10594
2013-11-29Ignore a deque test on windowsAlex Crichton-0/+1
I've seen this fail on windows twice now, and it's not clear to me why it's failing. For now, ignore it on that platform while investigation enuses.