Commit Graph

20732 Commits

Author SHA1 Message Date
Daniel Micay 9f74217d80 register snapshots 2013-08-03 21:09:28 -04:00
bors 34101d2320 auto merge of #8213 : kballard/rust/fd-limit, r=brson
Revert the workaround 49b72bd and instead bump the fd limit on OS X.
2013-08-03 07:46:53 -07:00
bors 6be014d23c auto merge of #8186 : huonw/rust/hashmap-=rt, r=Aatch
The `new` constructor uses the task-local RNG to retrieve seeds for the
two key values, which requires the runtime. Exposing a constructor that
takes the keys directly allows HashMaps to be used in programs that wish
to avoid the runtime.
2013-08-03 05:37:52 -07:00
Huon Wilson c852a5bb68 std: expose the keyed HashMap constructor, for runtime-less use.
The `new` constructor uses the task-local RNG to retrieve seeds for the
two key values, which requires the runtime. Exposing a constructor that
takes the keys directly allows HashMaps to be used in programs that wish
to avoid the runtime.
2013-08-03 21:00:32 +10:00
bors 2765811cb6 auto merge of #8206 : omasanori/rust/blk-to-block, r=graydon
Just for consistency.
2013-08-03 03:55:52 -07:00
bors 39fafd655a auto merge of #8204 : kballard/rust/str-into-owned, r=graydon
The method .into_owned() is meant to be used as an optimization when you
need to get a ~str from a Str, but don't want to unnecessarily copy it
if it's already a ~str.

This is meant to ease functions that look like

  fn foo<S: Str>(strs: &[S])

Previously they could work with the strings as slices using .as_slice(),
but producing ~str required copying the string, even if the vector
turned out be a &[~str] already.

I don't have any concrete uses for this yet, since the one conversion I've done to `&[S]` so far (see PR #8203) didn't actually need owned strings. But having this here may make using `Str` more attractive.

It also may be worth adding an `into_managed()` function, but that one is less obviously useful than `into_owned()`.
2013-08-03 02:10:54 -07:00
bors 20fad0f5ff auto merge of #8257 : mozilla/rust/rollup, r=thestinger
1f9c392 r=brson
54e685d r=graydon
1992765 r=thestinger
75155cd r=bblum
def8891 r=graydon
2013-08-03 00:25:56 -07:00
OGINO Masanori def88913d8 Move `use` statements.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:21:01 -04:00
OGINO Masanori 682939724f Rename sum -> _sum.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:56 -04:00
OGINO Masanori afaca4c822 Remove unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:45 -04:00
Kevin Ballard 75155cd1b0 Explicitly impl Clone for RWArc
RWArc had a clone() method, but it was part of impl RWArc instead of
an implementation of Clone.

Stick with the explicit implementation instead of deriving Clone so we
can have a docstring.

Fixes #8052.
2013-08-03 03:17:07 -04:00
Huon Wilson 1992765dd3 std: add benchmark for vec.mut_iter. 2013-08-03 03:13:13 -04:00
Huon Wilson fbb7cd32c3 std: use ptr.offset where possible in the vec iterator.
Closes #8212.
2013-08-03 03:13:11 -04:00
Kevin Ballard 54e685d4fd option: mutate() and mutate_default() should return bool
Fixes #8047.
2013-08-03 03:11:11 -04:00
toddaaro 1f9c392389 fixed the buffer to make it a more reasonable size 2013-08-03 03:09:23 -04:00
toddaaro eab749a5f3 modified logging function to truncate output and adjusted error output formatting tests to be compatible with both the new and old runtimes 2013-08-03 03:09:04 -04:00
Daniel Micay deddb009f0 Merge pull request #8244 from thestinger/for
make `for` parse as `foreach` does

r=huonw, bors is acting up and this has been run through the try bots
2013-08-03 00:07:20 -07:00
Daniel Micay 87cf2864b1 rm obsolete documentation on `for`
it is documented in the container/iterator tutorial, not the basic
tutorial
2013-08-03 03:00:42 -04:00
Daniel Micay b41d04763e make `for` parse as `foreach` does
Closes #6997
2013-08-03 03:00:42 -04:00
Daniel Micay b3ad685f7f replace all remaining `for` with `foreach` or `do` 2013-08-03 03:00:42 -04:00
bors 2a7be1c9e4 auto merge of #8235 : pcwalton/rust/unsafe-extern-fns, r=pcwalton
r? @brson
2013-08-02 22:05:03 -07:00
Patrick Walton 9457ebee55 librustc: Disallow "unsafe" for external functions 2013-08-02 21:57:59 -07:00
Patrick Walton 887c656970 librustc: Introduce a new visitor type based on traits and port syntax to it.
This is preparation for removing `@fn`.

This does *not* use default methods yet, because I don't know
whether they work. If they do, a forthcoming PR will use them.

This also changes the precedence of `as`.
2013-08-02 21:57:58 -07:00
Kevin Ballard 2001cc043b Bump fd limit on macos when running rt tests
OS X defaults the ulimit for open files to 256 for programs launched
from the Terminal (GUI apps get a higher default). Unfortunately this is
too low for the rt tests, which deliberately overcommit and create a lot
of threads (which means a lot of schedulers, and each scheduler needs at
least 2 fds).

By calling sysctl() and setrlimit() we can bump the fd limit up to the
maximum allowed (on stock OS X it's 10240).

Fixes #7772.
2013-08-02 21:20:15 -07:00
Kevin Ballard 70d2be0cec Revert "std::rt: Use a constant 4 threads for multithreaded sched tests"
This workaround was less than ideal. A better solution is to raise the
fd limit.

This reverts commit 49b72bdd77.
2013-08-02 21:18:32 -07:00
bors efd6eafeb4 auto merge of #8174 : DaGenix/rust/digest-improvements, r=brson
Same content as #8097, but bors had an issue with that pull request. Opening a new one.
2013-08-02 19:29:00 -07:00
Palmer Cox 1252472bb7 Sha1: Update Sha1 to use new functionality in cryptoutil.rs 2013-08-02 18:49:00 -04:00
Palmer Cox 4e7b0ee3cd Crypto: Add overflow checking addition functions.
Added functions to cryptoutil.rs that perform an addition after shifting
the 2nd parameter by a specified constant. These function fail!() if integer
overflow will result. Updated the Sha2 implementation to use these functions.
2013-08-02 18:49:00 -04:00
Palmer Cox 281b79525b Crypto: Add large input tests for all Digests
Create a helper function in cryptoutil.rs which feeds 1,000,000 'a's into
a Digest with varying input sizes and then checks the result. This is
essentially the same as one of Sha1's existing tests, so, that test was
re-implemented using this method. New tests were added using this method for
Sha512 and Sha256.
2013-08-02 18:49:00 -04:00
Palmer Cox 2cbe312343 Crypto: Remove DigestUtil and convert to default methods on the Digest trait. 2013-08-02 18:49:00 -04:00
Palmer Cox ee3f75366c Sha2: Re-write the Sha2 compression functions to improve performance.
The Sha2 compression functions were re-written to execute the message
scheduling calculations in the same loop as the rest of the compression
function. The compiler is able to generate much better code. Additionally,
innermost part of the compression functions were turned into macros to
reduce code duplicate and to make the functions more concise.
2013-08-02 18:49:00 -04:00
Palmer Cox 654c536fec Sha2: Create cryptoutil.rs and re-write the Sha2 module to make use of it.
There are 2 main pieces of functionality in cryptoutil.rs:
* A set of unsafe function for efficiently reading and writing u32 and u64
  values. All of these functions are fairly easy to audit to confirm that
  they do what they are supposed to.
* A FixedBuffer struct. This struct keeps track of input data until there
  is enough of it to execute the a function on it which expects a fixed
  block of data.

The Sha2 module was rewritten to take advantage of the new functions in
cryptoutil as well as FixedBuffer. The result is that the duplicate code
for maintaining a buffer of input data is removed from the Sha512 and
Sha256 implementation. Additionally, the FixedBuffer code is much more
efficient than the previous code was.
2013-08-02 18:48:14 -04:00
Palmer Cox 3cac62822e Sha2: Remove the result_X() methods; move logic into the Digest impls.
The result_X() methods just calculate an output of a fixed size. They don't
really have much to do with running the actually hash algorithm until the very
last step - the output. It makes much more sense to put all this logic into
the Digest impls for each specific variation on the hash function.
2013-08-02 18:46:11 -04:00
Palmer Cox 5b01555155 Sha2: Rearrage traits / impls / structs.
The code was arranged so that the core Sha2 code came first, and then
all of the various implementation of Digest followed along later. The
problem is that the Sha512 compression function code is far away from
the Sha512 Digest implementation, so, if you are trying to read over
the code, you need to scroll all around the file for no good reason. The
code was rearranged so that all of the Sha512 code is in one place and
all of the Sha256 code is in another and so that all impls for a struct
are near the definition of that struct.
2013-08-02 18:46:11 -04:00
Palmer Cox a1bbd18dc1 Sha2: Remove unecessary integer type specifications. 2013-08-02 18:46:11 -04:00
bors 3ddc72f69b auto merge of #8234 : bblum/rust/assorted-fixes, r=brson
This fixes 4 bugs that prevented the extra::arc and extra::sync tests from passing on the new runtime.

* In ```Add SendDeferred trait``` I add a non-rescheduling ```send_deferred``` method to our various channel types. The ```extra::sync``` concurrency primitives need this guarantee so they can send while inside of an exclusive. (This fixes deterministic deadlocks seen with ```RUST_THREADS=1```.)
* In "Fix nasty double-free bug" I make sure that a ```ChanOne``` suppresses_finalize *before* rescheduling away to the receiver, so in case it gets a kill signal upon coming back, the destructor is inhibited as desired. (This is pretty uncommon on multiple CPUs but showed up always with ```RUST_THREADS=1```.)
* In ```Fix embarrassing bug where 'unkillable' would unwind improperly``` I make sure the task's unkillable counter stays consistent when a kill signal is received right at the start of an unkillable section. (This is a very uncommon race and can only occur with multiple CPUs.)
* In ```Don't fail from kill signals if already unwinding``` I do pretty much what it says on the tin. Surprising that it took the whole suite of sync/arc tests to expose this.

The other two commits are cleanup.

r @brson
2013-08-02 14:55:54 -07:00
Ben Blum 43fecf3556 Add an assert_may_sleep() check on every context switch. 2013-08-02 17:31:45 -04:00
Ben Blum 92f60f4365 Don't fail from kill signals if already unwinding. 2013-08-02 17:31:45 -04:00
Ben Blum bd35798773 (cleanup) Use more do...finally in extra::sync. 2013-08-02 17:31:45 -04:00
Ben Blum d30cca46e6 Fix embarrassing bug where 'unkillable' would unwind improperly when it receives a kill signal. 2013-08-02 17:31:45 -04:00
Ben Blum cde6ad3992 Fix nasty double-free bug where a newrt chan could get killed after rescheduling but before suppressing_finalize. 2013-08-02 17:31:44 -04:00
Ben Blum be7738bfa1 Add SendDeferred trait and use it to fix #8214. 2013-08-02 17:31:44 -04:00
bors f1c1f92d0c auto merge of #8221 : brson/rust/single-threaded, r=graydon
This is the last major runtime feature needed for the transition to the new scheduler.
2013-08-02 10:52:50 -07:00
bors fc571820d1 auto merge of #8202 : pnkfelix/rust/fsk-issue8056-make-crates-must-dep-on-subcrates, r=graydon
Reorder TEST_HOST_CRATES in hopes of exposing future instances of this bug.

Fix #8056
2013-08-02 09:13:53 -07:00
bors 986df44753 auto merge of #8195 : bblum/rust/task-cleanup, r=brson
In the first commit it is obvious why some of the barriers can be changed to ```Relaxed```, but it is not as obvious for the once I changed in ```kill.rs```. The rationale for those is documented as part of the documenting commit.

Also the last commit is a temporary hack to prevent kill signals from being received in taskgroup cleanup code, which could be fixed in a more principled way once the old runtime is gone.
2013-08-02 07:31:52 -07:00
bors af97339771 auto merge of #8193 : cmr/rust/linux-errno, r=graydon 2013-08-02 05:49:53 -07:00
bors 2460170e6a auto merge of #8188 : huonw/rust/cfg-macro, r=pcwalton
Example:

    if cfg!(test) {
       calculation_to_run_only_when_testing();
    }

Closes #8130.
2013-08-02 03:52:51 -07:00
bors dbde42e59e auto merge of #8175 : brson/rust/nodbg, r=graydon
This stuff is ancient, unused, and tied to oldsched
2013-08-02 01:13:51 -07:00
Brian Anderson c3fa411459 std: Implement SingleThreaded spawn mode for newsched 2013-08-02 00:26:45 -07:00
bors bbcce8d95c auto merge of #8216 : thestinger/rust/range, r=huonw 2013-08-01 22:10:45 -07:00