about summary refs log tree commit diff
path: root/src/libextra
AgeCommit message (Collapse)AuthorLines
2013-09-17remove unnecessary transmutesDaniel Micay-1/+0
2013-09-17auto merge of #9244 : thestinger/rust/drop, r=catamorphismbors-16/+13
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-16switch Drop to `&mut self`Daniel Micay-16/+13
2013-09-16auto merge of #9231 : cmr/rust/enum_encoding, r=catamorphismbors-15/+24
2013-09-16auto merge of #9211 : klutzy/rust/win32-fix, r=alexcrichtonbors-9/+0
2013-09-16extra::json: use a different encoding for enums.Corey Richardson-15/+24
It now uses `{"type": VariantName, "fields": [...]}`, which, according to @Seldaek, since all enums will have the same "shape" rather than being a weird ad-hoc array, will optimize better in javascript JITs. It also looks prettier, and makes more sense.
2013-09-16Have workcache::test put `foo.c` in the same directory it runs in.Lindsey Kuper-7/+16
This prevents a stray `foo.c` from being left lying around after tests run, and it's more consistent with the rest of the code.
2013-09-16extra::fileinput: Enable tests on Win32klutzy-9/+0
They were blocked by #8810, but it works now.
2013-09-15Remove {uint,int,u64,i64,...}::from_str,from_str_radixblake2-ppc-8/+6
Remove these in favor of the two traits themselves and the wrapper function std::from_str::from_str. Add the function std::num::from_str_radix in the corresponding role for the FromStrRadix trait.
2013-09-15Use std::iter::range_stepblake2-ppc-26/+18
Use the iterator version instead of the old uint::/int::range_step functions.
2013-09-14auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphismbors-27/+25
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
2013-09-14auto merge of #9115 : erickt/rust/master, r=ericktbors-41/+88
This is a series of patches to modernize option and result. The highlights are: * rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)` * add `.unwrap_or_default()` that uses the `Default` trait * add `Default` implementations for vecs, HashMap, Option * add `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>` * add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither` * renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`. * Added a bunch of impls of `Default` * Added a `#[deriving(Default)]` syntax extension * Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-13Remove all usage of change_dir_lockedAlex Crichton-94/+3
While usage of change_dir_locked is synchronized against itself, it's not synchronized against other relative path usage, so I'm of the opinion that it just really doesn't help in running tests. In order to prevent the problems that have been cropping up, this completely removes the function. All existing tests (except one) using it have been moved to run-pass tests where they get their own process and don't need to be synchronized with anyone else. There is one now-ignored rustpkg test because when I moved it to a run-pass test apparently run-pass isn't set up to have 'extern mod rustc' (it ends up having linkage failures).
2013-09-14extra::workcache: Remodel the (internal) struct Workblake2-ppc-16/+16
Using an enum with two cases for `Work` reveals simpler code than the previous `Option<Either<X, Y>>` representation.
2013-09-14extra::test: Use Result instead of Either.blake2-ppc-11/+9
OptRes was combining a successful value with an error message, which fits the Result type perfectly.
2013-09-13auto merge of #9170 : alexcrichton/rust/flaky-fileinput, r=ericktbors-188/+0
The glob tests cannot change the current working directory because the other tests (namely the fileinput ones) depend on the current working directory not changing.
2013-09-13Move glob tests to a run-pass testAlex Crichton-188/+0
The normal unit tests cannot change the current working directory because it messes with the other tests which depend on a particular working directory.
2013-09-13auto merge of #9141 : alexcrichton/rust/ignore-fileinput, r=catamorphismbors-10/+23
These tests are being very flaky on the bots, and the reason is that files are being created and then when attempted to get read they actually don't exist. I'm not entirely sure why this is happening, but I also don't fully trust the std::io implemention using @-boxes to close/flush/write files at the right time. This moves the tests to using std::rt::io which is hopefully more robust and something that we can actually reason about. Sadly, due to #8810, these tests fail on windows, so they're all ignored on windows right now.
2013-09-12syntax: add #[deriving(Default)] syntax extensionErick Tryzelaar-2/+42
2013-09-12std: Add a bunch of Default implsErick Tryzelaar-0/+7
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-36/+36
2013-09-12std: Add Option.{and,and_then,or,or_else}Erick Tryzelaar-2/+2
2013-09-12std: rename Option::unwrap_or_default() to unwrap_or()Erick Tryzelaar-1/+1
2013-09-12auto merge of #8908 : tikue/rust/master, r=anasazibors-2/+102
SyncChan blocks after sending a message until the SyncPort acknowledges receipt of the message.
2013-09-12auto merge of #9131 : Dretch/rust/glob-range-patterns, r=alexcrichtonbors-14/+126
This feature was overlooked in the original pull request (#8914). r? @alexcrichton
2013-09-12auto merge of #9096 : huonw/rust/linenoise, r=brsonbors-31/+73
- Wrap calls into linenoise in a mutex so that the functions don't have to be `unsafe` any more (fixes #3921) - Stop leaking every line that linenoise reads. - Handle the situation of `rl::complete(some_function); do spawn { rl::read(""); }` which would crash (`fail!` that turned into an abort, possibly due to failing with the lock locked) when the user attempted to tab-complete anything. - Add a test for the various functions; it has to be run by hand to verify anything works, but it won't bitrot.
2013-09-12Rewrite fileinput tests to use std::rt::ioAlex Crichton-10/+23
These tests are being very flaky on the bots, and the reason is that files are being created and then when attempted to get read they actually don't exist. I'm not entirely sure why this is happening, but I also don't fully trust the std::io implemention using @-boxes to close/flush/write files at the right time. This moves the tests to using std::rt::io which is hopefully more robust and something that we can actually reason about. Sadly, due to #8810, these tests fail on windows, so they're all ignored on windows right now.
2013-09-11Rendezvous stream for synchronous channel messagingTim Kuehn-2/+102
2013-09-11auto merge of #9014 : dcrewi/rust/convert-between-bigints, r=anasazibors-42/+130
2013-09-11Support character range patterns (e.g. [0-9], [a-z]), like other globs do.Gareth Smith-14/+126
2013-09-11extra: improvements & bug fixes to rl.Huon Wilson-18/+26
- Removes a layer of indirection in the storage of the completion callback. - Handles user tab completion in a task in which `complete` hasn't been properly. Previously, if `complete` was called in one task, and `read` called in another, attempting to get completions would crash. This makes the completion handlers non-ambiguously task-local only. - Fix a mismatch in return values between the Rust code and linenoise.
2013-09-11extra: stop rl from leaking each line that is read.Huon Wilson-1/+11
2013-09-11extra: use a mutex to wrap linenoise calls and make them threadsafe.Huon Wilson-18/+42
Fixes #3921.
2013-09-11auto merge of #9007 : dcrewi/rust/random-bigints, r=huonwbors-0/+64
2013-09-09auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichtonbors-5/+2
Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations. Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument. Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end. Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`. Remove `equal_sizes`
2013-09-10std::at_vec and vec: Unify build_sized, build_sized_opt into buildblake2-ppc-5/+2
These functions have very few users since they are mostly replaced by iterator-based constructions. Convert a few remaining users in-tree, and reduce the number of functions by basically renaming build_sized_opt to build, and removing the other two. This for both the vec and the at_vec versions.
2013-09-09auto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajackbors-20/+146
r? @metajack or @brson - This pull request makes rustpkg use the workcache library to avoid recompilation.
2013-09-09auto merge of #9083 : dcrewi/rust/biguint-bit-ops, r=brsonbors-0/+79
2013-09-09Implement bitwise operations on BigUintDavid Creswick-0/+79
2013-09-09Merge RandBigUint and RandBigInt into single traitDavid Creswick-21/+17
2013-09-09Convert between BigInts, BigUints, ints, and uintsDavid Creswick-53/+100
Previously, conversion to ints, uints, and BigUints clamped the value within the range of that datatype. With this commit, conversion overflows fail the task. To handle overflows gracefully, use the new to_*_opt() methods.
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-24/+20
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-08extra: Address review comments from JackTim Chevalier-12/+13
2013-09-08rustpkg: Use workcacheTim Chevalier-2/+7
rustpkg now uses the workcache library to avoid recompilation. Hooray!
2013-09-08workcache: Add the ability to save and load the database...Tim Chevalier-19/+139
...as well as the ability to discover inputs and outputs.
2013-09-07Renamed Uuid::from_utf8 to Uuid::from_bytesSteven Fackler-5/+5
This method doesn't deal with utf8. I guess it got caught in a mass rename.
2013-09-06auto merge of #9026 : jbclements/rust/let-var-hygiene, r=jbclementsbors-22/+40
This is a rebase of my approved pull request from ... the end of June? It introduces hygiene for let-bound variables.
2013-09-06auto merge of #9016 : sfackler/rust/nanoseconds, r=alexcrichtonbors-3/+37
The ISO 8601 standard does not mandate any specific precision for fractional seconds, so this accepts input of any length, ignoring the part after the nanoseconds place. It may be more correct to round with the tenths of nanoseconds digit, but then we'd have to deal with carrying the round through the entire Tm struct (e.g. for a time like Dec 31 11:59.999999999999). %f is the format specifier that Python's datetime library uses for 0-padded microseconds so it seemed appropriate here. cc #2350
2013-09-06use enumerate in place of 'for ti in range(i, tokens.len()) ... match ↵Tim Kuehn-4/+4
tokens[ti] ...'
2013-09-06Incorporate feedback from huonwDavid Creswick-7/+22
- use identifiers with underscores to avoid unused variable warning - implement on R: Rng instead of on R: RngUtil - bugfix: zero BigInts were being generated twice as often as any other number - test that gen_biguint(0) always returns zero