]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #8656 : toddaaro/rust/idle-opt+cleaning, r=brson
bors [Wed, 21 Aug 2013 01:51:55 +0000 (18:51 -0700)]
auto merge of #8656 : toddaaro/rust/idle-opt+cleaning, r=brson

Fixed a memory leak caused by the singleton idle callback failing to close correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.

10 years agoauto merge of #8631 : anasazi/rust/homing-io, r=brson
bors [Wed, 21 Aug 2013 00:12:09 +0000 (17:12 -0700)]
auto merge of #8631 : anasazi/rust/homing-io, r=brson

libuv handles are tied to the event loop that created them. In order to perform IO, the handle must be on the thread with its home event loop. Thus, when as task wants to do IO it must first go to the IO handle's home event loop and pin itself to the corresponding scheduler while the IO action is in flight. Once the IO action completes, the task is unpinned and either returns to its home scheduler if it is a pinned task, or otherwise stays on the current scheduler.

Making new blocking IO implementations (i.e. files) thread safe is rather simple. Add a home field to the IO handle's struct in uvio and implement the HomingIO trait. Wrap every IO call in the HomingIO.home_for_io method, which will take care of the scheduling.

I'm not sure if this remains thread safe in the presence of asynchronous IO at the libuv level. If we decide to do that, then this set up should be revisited.

10 years agoFixed a memory leak caused by the singleton idle callback failing to close correctly...
toddaaro [Tue, 20 Aug 2013 22:33:20 +0000 (15:33 -0700)]
Fixed a memory leak caused by the singleton idle callback failing to close correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.

10 years agoauto merge of #8563 : graydon/rust/2013-08-16-condition-tutorial, r=catamorphism
bors [Tue, 20 Aug 2013 22:01:55 +0000 (15:01 -0700)]
auto merge of #8563 : graydon/rust/2013-08-16-condition-tutorial, r=catamorphism

First cut of a tutorial on conditions.

cc: #6701

10 years agoauto merge of #8519 : msullivan/rust/objects, r=catamorphism
bors [Tue, 20 Aug 2013 20:32:00 +0000 (13:32 -0700)]
auto merge of #8519 : msullivan/rust/objects, r=catamorphism

r?

10 years agoauto merge of #8328 : alexcrichton/rust/llvm-head, r=brson
bors [Tue, 20 Aug 2013 18:31:59 +0000 (11:31 -0700)]
auto merge of #8328 : alexcrichton/rust/llvm-head, r=brson

The first commit message is pretty good, but whomever reviews this should probably also at least glance at the changes I made in LLVM. I basically reorganized our pending patch queue to be a bit more organized and clearer in what needs to go where. After this, our queue would be:

* Add the `no-split-stack` attribute
* Add the `fixedstacksegment` attribute
* Add split-stacks for arm android
* Add split-stacks for arm linux
* Add split stacks for mips

Then there's a patch which I added to get rust to build at all on LLVM-head, and I'm not quite sure why it's there, but nothing seems to be crashing for now! (famous last words).

Otherwise, I just updated code to reflect the changes I made in LLVM with the only major change being the advent of the new `no_split_stack` attribute. This is work towards #1226, but someone more familiar with the code should probably actually assign the attribute to the appropriate functions.

Also as a bonus, I've verified that this closes #5774

10 years agoauto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brson
bors [Tue, 20 Aug 2013 16:42:00 +0000 (09:42 -0700)]
auto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brson

Instead of a furious storm of idle callbacks we just have one. This is a major performance gain - around 40% on my machine for the ping pong bench.

Also in this PR is a cleanup commit for the scheduler code. Was previously up as a separate PR, but bors load + imminent merge hell led me to roll them together. Was #8549.

10 years agoFix LLVM compilation issues and use the new attrs
Alex Crichton [Tue, 6 Aug 2013 04:21:37 +0000 (21:21 -0700)]
Fix LLVM compilation issues and use the new attrs

This implements #[no_split_stack] and also changes #[fast_ffi] to using the new
"fixedstacksegment" string attribute instead of integer attribute.

10 years agoauto merge of #8463 : brson/rust/borrowck, r=nmatsakis,nikomatsakis
bors [Tue, 20 Aug 2013 13:41:58 +0000 (06:41 -0700)]
auto merge of #8463 : brson/rust/borrowck, r=nmatsakis,nikomatsakis

r? @nikomatsakis

10 years agoauto merge of #8638 : pnkfelix/rust/fsk-visitor-vpar-defaults-step5, r=huonw
bors [Tue, 20 Aug 2013 10:52:01 +0000 (03:52 -0700)]
auto merge of #8638 : pnkfelix/rust/fsk-visitor-vpar-defaults-step5, r=huonw

"non-mechanical" : there was lots more hacking than the other more-mechanical ports Felix did.

r? @huonw.  (Or @nikomatsakis ; I just want someone to sanity-check this.  Its not a thing of beauty.)

Followup to #8623.  (See #8527, which was step 1 of 5, for the full outline.  Part of #7081.)

Notes on the change follow.

There's also a strange pattern that I hacked in to accommodate the
Outer/Inner traversal structure of the existing code (which was
previously encoding this by untying the Y-combinator style knot of the
vtable, and then retying it but superimposing new methods that "stop
at items").  I hope either I or someone else can come back in the
future and replace this ugliness with something more natural.

Added boilerplate macro; all the OuterLint definitions are the same
(but must be abstracted over implementing struct, thus the macro).

Revised lint.rs use declarations to make ast references explicit.
Also removed unused imports.

10 years agoadd line break post dbaupp review.
Felix S. Klock II [Tue, 20 Aug 2013 10:25:34 +0000 (12:25 +0200)]
add line break post dbaupp review.

10 years agoremove trailing whitespace to placate make tidy.
Felix S. Klock II [Tue, 20 Aug 2013 09:09:47 +0000 (11:09 +0200)]
remove trailing whitespace to placate make tidy.

10 years agoPort lint.rs from oldvisit to <V:Visit> trait API. Less mechanical port.
Felix S. Klock II [Wed, 14 Aug 2013 08:24:42 +0000 (10:24 +0200)]
Port lint.rs from oldvisit to <V:Visit> trait API.  Less mechanical port.

That is, there was lots more hacking than the other more-mechanical
ports Felix did.

There's also a strange pattern that I hacked in to accommodate the
Outer/Inner traversal structure of the existing code (which was
previously encoding this by untying the Y-combinator style knot of the
vtable, and then retying it but superimposing new methods that "stop
at items").  I hope either I or someone else can come back in the
future and replace this ugliness with something more natural.

Added boilerplate macro; all the OuterLint definitions are the same
(but must be abstracted over implementing struct, thus the macro).

Revised lint.rs use declarations to make ast references explicit.
Also removed unused imports.

10 years agoUpgrade llvm to current HEAD
Alex Crichton [Tue, 6 Aug 2013 04:19:48 +0000 (21:19 -0700)]
Upgrade llvm to current HEAD

* This has one workaround patch (everything's testing just fine...)
* I reworked the fixedstacksegment attribute to be specified with a string
  rather than using a keyword and an integer and modifying the parser
* I added a "no-split-stack" attribute along the same lines as the
  "fixedstacksegment" attribute for #1226

10 years agoauto merge of #8548 : catamorphism/rust/unignore-rustpkg-tests, r=catamorphism
bors [Tue, 20 Aug 2013 06:41:55 +0000 (23:41 -0700)]
auto merge of #8548 : catamorphism/rust/unignore-rustpkg-tests, r=catamorphism

r? @brson This necessitated some cleanup to how we parse library filenames
when searching for libraries, since rustpkg may now create filenames
that contain '-' characters. Also cleaned up how rustpkg passes the
sysroot to a custom build script.

10 years agostd: Restore dynamic borrow tracking
Brian Anderson [Mon, 12 Aug 2013 01:54:23 +0000 (18:54 -0700)]
std: Restore dynamic borrow tracking

10 years agoauto merge of #8584 : thestinger/rust/jemalloc, r=graydon
bors [Tue, 20 Aug 2013 03:21:58 +0000 (20:21 -0700)]
auto merge of #8584 : thestinger/rust/jemalloc, r=graydon

This reverts commit 371a316ec93a977f9dcd305b5f532cd394fa6885.

Closes #7217

10 years agojemalloc: use $(AR), not `ar`
Daniel Micay [Tue, 20 Aug 2013 00:52:28 +0000 (20:52 -0400)]
jemalloc: use $(AR), not `ar`

10 years agoregenerate configure
Graydon Hoare [Tue, 20 Aug 2013 00:43:47 +0000 (17:43 -0700)]
regenerate configure

10 years agoauto merge of #8500 : graydon/rust/2013-08-13-self-rollup, r=thestinger
bors [Tue, 20 Aug 2013 00:42:35 +0000 (17:42 -0700)]
auto merge of #8500 : graydon/rust/2013-08-13-self-rollup, r=thestinger

close #8424 r=brson
close #8173 r=brson
close #8209 r=strcat

10 years agodoc: add condition tutorial
Graydon Hoare [Fri, 16 Aug 2013 23:03:24 +0000 (16:03 -0700)]
doc: add condition tutorial

10 years agoMake IO thread-safe.
Eric Reed [Fri, 9 Aug 2013 01:58:18 +0000 (18:58 -0700)]
Make IO thread-safe.

Each IO handle has a home event loop, which created it.
When a task wants to use an IO handle, it must first make sure it is on that home event loop.
It uses the scheduler handle in the IO handle to send itself there before starting the IO action.
Once the IO action completes, the task restores its previous home state.
If it is an AnySched task, then it will be executed on the new scheduler.
If it has a normal home, then it will return there before executing any more code after the IO action.

10 years agoHomed UDP sockets
Eric Reed [Wed, 7 Aug 2013 11:05:06 +0000 (04:05 -0700)]
Homed UDP sockets

10 years agoWorking homing UDP socket prototype.
Eric Reed [Wed, 7 Aug 2013 09:57:33 +0000 (02:57 -0700)]
Working homing UDP socket prototype.

10 years agoInstruct event loops to ignore SIGPIPE when constructed.
Eric Reed [Fri, 9 Aug 2013 00:04:19 +0000 (17:04 -0700)]
Instruct event loops to ignore SIGPIPE when constructed.

libuv does not always catch SIGPIPE.

10 years agoDo not execute the callback before cleaning up resources.
Eric Reed [Fri, 9 Aug 2013 00:10:22 +0000 (17:10 -0700)]
Do not execute the callback before cleaning up resources.

10 years agoDerive Clone for IpAddr and SocketAddr
Eric Reed [Thu, 8 Aug 2013 23:56:04 +0000 (16:56 -0700)]
Derive Clone for IpAddr and SocketAddr

10 years agort: make jemalloc header conform to android signature.
Graydon Hoare [Mon, 19 Aug 2013 23:09:46 +0000 (16:09 -0700)]
rt: make jemalloc header conform to android signature.

10 years agorustpkg: Un-ignore most of the remaining tests
Tim Chevalier [Fri, 16 Aug 2013 01:36:39 +0000 (18:36 -0700)]
rustpkg: Un-ignore most of the remaining tests

This necessitated some cleanup to how we parse library filenames
when searching for libraries, since rustpkg may now create filenames
that contain '-' characters. Also cleaned up how rustpkg passes the
sysroot to a custom build script.

10 years agocompiletest: do not run tests in sub-threads if on valgrind.
Graydon Hoare [Mon, 19 Aug 2013 22:08:47 +0000 (15:08 -0700)]
compiletest: do not run tests in sub-threads if on valgrind.

10 years agoTry to fix mac valgrind bot by disabling thread-heavy activities.
Graydon Hoare [Fri, 9 Aug 2013 23:30:44 +0000 (16:30 -0700)]
Try to fix mac valgrind bot by disabling thread-heavy activities.

10 years agoAdd tests for cross-crate condition handling. Close #5446.
Graydon Hoare [Fri, 2 Aug 2013 01:09:20 +0000 (18:09 -0700)]
Add tests for cross-crate condition handling. Close #5446.

10 years agotest: add testcase, close #4929 which was already fixed.
Graydon Hoare [Thu, 1 Aug 2013 19:00:24 +0000 (12:00 -0700)]
test: add testcase, close #4929 which was already fixed.

10 years agotest: un-xfail now working run-pass/foreign-struct.rs, close #2334.
Graydon Hoare [Thu, 1 Aug 2013 01:31:05 +0000 (18:31 -0700)]
test: un-xfail now working run-pass/foreign-struct.rs, close #2334.

10 years agoauto merge of #8623 : pnkfelix/rust/fsk-visitor-vpar-defaults-step4, r=nmatsakis
bors [Mon, 19 Aug 2013 22:02:07 +0000 (15:02 -0700)]
auto merge of #8623 : pnkfelix/rust/fsk-visitor-vpar-defaults-step4, r=nmatsakis

Follow up to #8619 (step 3 of 5).

(See #8527, which was step 1 of 5, for the full outline.)

Part of #7081.

10 years agoauto merge of #8459 : thestinger/rust/checked, r=graydon
bors [Mon, 19 Aug 2013 19:42:48 +0000 (12:42 -0700)]
auto merge of #8459 : thestinger/rust/checked, r=graydon

10 years agoclean whitespace :/
toddaaro [Mon, 19 Aug 2013 19:01:13 +0000 (12:01 -0700)]
clean whitespace :/

10 years agoMake supertrait methods callable on object types.
Michael Sullivan [Tue, 13 Aug 2013 20:22:58 +0000 (13:22 -0700)]
Make supertrait methods callable on object types.

This requires changes to method search and to codegen. We now emit a
vtable for objects that includes methods from all supertraits.
Closes #4100.

Also, actually populate the cache for vtables, and also key it by type
so that it actually works.

10 years agoRangechange the log message truncation limit.
Michael Sullivan [Tue, 13 Aug 2013 23:37:02 +0000 (16:37 -0700)]
Rangechange the log message truncation limit.

10 years agoauto merge of #8619 : pnkfelix/rust/fsk-visitor-vpar-defaults-step3, r=nmatsakis
bors [Mon, 19 Aug 2013 16:12:03 +0000 (09:12 -0700)]
auto merge of #8619 : pnkfelix/rust/fsk-visitor-vpar-defaults-step3, r=nmatsakis

Follow up to #8539 (step 2 of 5).

(See  #8527, which was step 1 of 5, for the full outline.)

Part of #7081.

10 years agoauto merge of #8539 : pnkfelix/rust/fsk-visitor-vpar-defaults-step2, r=graydon,nikoma...
bors [Mon, 19 Aug 2013 13:52:03 +0000 (06:52 -0700)]
auto merge of #8539 : pnkfelix/rust/fsk-visitor-vpar-defaults-step2, r=graydon,nikomatsakis

r? @nikomatsakis

Follow up to #8527 (which was step 1 of 5).  See that for overall description

Part of #7081

10 years agoauto merge of #8535 : nikomatsakis/rust/issue-3678-wrappers-be-gone-2, r=graydon
bors [Mon, 19 Aug 2013 11:32:04 +0000 (04:32 -0700)]
auto merge of #8535 : nikomatsakis/rust/issue-3678-wrappers-be-gone-2, r=graydon

Long-standing branch to remove foreign function wrappers altogether. Calls to C functions are done "in place" with no stack manipulation; the scheme relies entirely on the correct use of `#[fixed_stack_segment]` to guarantee adequate stack space. A linter is added to detect when `#[fixed_stack_segment]` annotations are missing. An `externfn!` macro is added to make it easier to declare foreign fns and wrappers in one go: this macro may need some refinement, though, for example it might be good to be able to declare a group of foreign fns. I leave that for future work (hopefully somebody else's work :) ).

Fixes #3678.

10 years agoAdd externfn macro and correctly label fixed_stack_segments
Niko Matsakis [Thu, 15 Aug 2013 01:41:40 +0000 (21:41 -0400)]
Add externfn macro and correctly label fixed_stack_segments

10 years agoIssue #3678: Remove wrappers and call foreign functions directly
Niko Matsakis [Tue, 21 May 2013 19:25:44 +0000 (15:25 -0400)]
Issue #3678: Remove wrappers and call foreign functions directly

10 years agoauto merge of #8564 : alexcrichton/rust/ifmt+++, r=graydon
bors [Mon, 19 Aug 2013 08:42:05 +0000 (01:42 -0700)]
auto merge of #8564 : alexcrichton/rust/ifmt+++, r=graydon

See discussion in #8489, but this selects option 3 by adding a `Default` trait to be implemented by various basic types.

Once this makes it into a snapshot I think it's about time to start overhauling all current use-cases of `fmt!` to move towards `ifmt!`. The goal is to replace `%X` with `{}` in 90% of situations, and this commit should enable that.

10 years agoauto merge of #8556 : sfackler/rust/quote, r=alexcrichton
bors [Mon, 19 Aug 2013 04:51:58 +0000 (21:51 -0700)]
auto merge of #8556 : sfackler/rust/quote, r=alexcrichton

They previously required one called "ext_cx" to be in scope.

Fixes part of #7727

10 years agoauto merge of #8565 : bblum/rust/select-bugfix, r=brson
bors [Mon, 19 Aug 2013 02:32:36 +0000 (19:32 -0700)]
auto merge of #8565 : bblum/rust/select-bugfix, r=brson

@brson grilled me about how this bugfix worked the first time around, and it occurred to me that it didn't in the case where the task is unwinding. Now it will.

10 years agoauto merge of #8561 : kballard/rust/do-block-internal-err-msg, r=thestinger
bors [Mon, 19 Aug 2013 00:12:02 +0000 (17:12 -0700)]
auto merge of #8561 : kballard/rust/do-block-internal-err-msg, r=thestinger

When using a `do` block to call an internal iterator, if you forgot to
return a value from the body, it would tell you

    error: Do-block body must return bool, but returns () here. Perhaps
    you meant to write a `for`-loop?

This advice no longer applies as `for` loops are now for external
iterators. Delete this message outright and let it use the default error
message

    error: mismatched types: expected `bool` but found `()`

r? @thestinger

10 years agoauto merge of #8560 : kballard/rust/reserve-yield, r=pcwalton
bors [Sun, 18 Aug 2013 22:02:04 +0000 (15:02 -0700)]
auto merge of #8560 : kballard/rust/reserve-yield, r=pcwalton

Rename task::yield() to task::deschedule().

Fixes #8494.

10 years agoauto merge of #8545 : blake2-ppc/rust/iterbytes, r=alexcrichton
bors [Sun, 18 Aug 2013 19:41:59 +0000 (12:41 -0700)]
auto merge of #8545 : blake2-ppc/rust/iterbytes, r=alexcrichton

Address issue #5257, for example these values all had the same hash value:

("aaa", "bbb", "ccc")
("aaab", "bb", "ccc")
("aaabbb", "", "ccc")

IterBytes for &[A] now includes the length, before calling iter_bytes on
each element.

IterBytes for &str is now terminated by a byte that does not appear in
UTF-8. This way only one more byte is processed when hashing strings.

10 years agoquote_*! macros take an ExtCtx
Steven Fackler [Thu, 15 Aug 2013 06:06:33 +0000 (02:06 -0400)]
quote_*! macros take an ExtCtx

They previously required one called "ext_cx" to be in scope.

Fixes part of #7727

10 years agoauto merge of #8558 : kballard/rust/xorshift-seed, r=cmr
bors [Sun, 18 Aug 2013 17:01:55 +0000 (10:01 -0700)]
auto merge of #8558 : kballard/rust/xorshift-seed, r=cmr

Fixes #8359.

10 years agostd::hash: Add testcase for colliding hashes of tuples
blake2-ppc [Sun, 18 Aug 2013 13:23:42 +0000 (15:23 +0200)]
std::hash: Add testcase for colliding hashes of tuples

Add a testcase that verifies that (s, t) and (u, v) don't collide even if
s + t == u + v (concatenation).

10 years agostd::to_bytes: Implement IterBytes on 1- to 8-tuples
blake2-ppc [Thu, 15 Aug 2013 21:51:39 +0000 (23:51 +0200)]
std::to_bytes: Implement IterBytes on 1- to 8-tuples

10 years agostd::to_bytes: Delimit sequences &[A] and ~str when hashing
blake2-ppc [Thu, 15 Aug 2013 03:23:33 +0000 (05:23 +0200)]
std::to_bytes: Delimit sequences &[A] and ~str when hashing

Address issue #5257, for example these values all had the same hash value:

("aaa", "bbb", "ccc")
("aaab", "bb", "ccc")
("aaabbb", "", "ccc")

IterBytes for &[A] now includes the length, before calling iter_bytes on
each element.

IterBytes for &str is now terminated by a byte that does not appear in
UTF-8. This way only one more byte is processed when hashing strings.

10 years agoauto merge of #8555 : chris-morgan/rust/time-clone, r=huonw
bors [Sun, 18 Aug 2013 14:21:58 +0000 (07:21 -0700)]
auto merge of #8555 : chris-morgan/rust/time-clone, r=huonw

I need `Clone` for `Tm` for my latest work on [rust-http](https://github.com/chris-morgan/rust-http) (static typing for headers, and headers like `Date` are a time), so here it is.

@huonw recommended deriving DeepClone while I was at it.

I also had to implement `DeepClone` for `~str` to get a derived implementation of `DeepClone` for `Tm`; I did `@str` while I was at it, for consistency.

10 years agoauto merge of #8551 : huonw/rust/speling, r=alexcrichton
bors [Sun, 18 Aug 2013 12:11:58 +0000 (05:11 -0700)]
auto merge of #8551 : huonw/rust/speling, r=alexcrichton

(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)

10 years agoauto merge of #8550 : kballard/rust/token-start-err-msg, r=catamorphism
bors [Sun, 18 Aug 2013 09:51:59 +0000 (02:51 -0700)]
auto merge of #8550 : kballard/rust/token-start-err-msg, r=catamorphism

The span was fixed at some point to point to the correct character, but
the error message is still bad. Update it to emit the actual character
in question (potentially escaped).

Fixes #3747.

10 years agoauto merge of #8547 : kballard/rust/trait-parse-err-msg, r=alexcrichton
bors [Sun, 18 Aug 2013 05:52:00 +0000 (22:52 -0700)]
auto merge of #8547 : kballard/rust/trait-parse-err-msg, r=alexcrichton

When parsing a trait function, the function must end with either `;` or
`{` (signifying a default implementation). The error message incorrectly
stated that it must be `;` or `}`.

Fixes #6610.

10 years agoauto merge of #8544 : dim-an/rust/fix-match-pipes, r=pcwalton
bors [Sun, 18 Aug 2013 03:12:02 +0000 (20:12 -0700)]
auto merge of #8544 : dim-an/rust/fix-match-pipes, r=pcwalton

Pointers to bound variables shouldn't be stored before checking pattern,
otherwise piped patterns can conflict with each other (issue #6338).

Closes #6338.

10 years agoRevert "Turn off jemalloc"
Daniel Micay [Sat, 17 Aug 2013 23:46:52 +0000 (19:46 -0400)]
Revert "Turn off jemalloc"

This reverts commit 371a316ec93a977f9dcd305b5f532cd394fa6885.

Closes #7217

10 years agoMore spelling corrections.
Huon Wilson [Sat, 17 Aug 2013 22:28:04 +0000 (08:28 +1000)]
More spelling corrections.

10 years agoauto merge of #8554 : michaelwoerister/rust/generics, r=brson
bors [Sat, 17 Aug 2013 22:22:04 +0000 (15:22 -0700)]
auto merge of #8554 : michaelwoerister/rust/generics, r=brson

This pull request includes support for generic functions and self arguments in methods, and combinations thereof. This also encompasses any kind of trait methods, regular and static, with and without default implementation. The implementation is backed up by a felt ton of test cases `:)`

This is a very important step towards being able to compile larger programs with debug info, since practically any generic function caused an ICE before.

One point worth discussing is that activating debug info now automatically (and silently) sets the `no_monomorphic_collapse` flag. Otherwise debug info would show wrong type names in all but one instance of the monomorphized function.

Another thing to note is that the handling of generic types does not strictly follow the DWARF specification. That is, variables with type `T` (where `T=int`) are described as having type `int` and not as having type `T`. In other words, we are losing information whether a variable has been declared with a type parameter as its type. In practice this should not make much of difference though since the concrete type is mostly what one is interested in. I'll post an issue later so this won't be forgotten.

Also included are a number of bug fixes:
* Closes #1758
* Closes #8513
* Closes #8443
* Fixes handling of field names in tuple structs
* Fixes and re-enables test case for option-like enums that relied on undefined behavior before
* Closes #1339 (should have been closed a while ago)

Cheers,
Michael

10 years agoauto merge of #8433 : brson/rust/rm-more-oldrt-crud, r=brson
bors [Sat, 17 Aug 2013 19:51:57 +0000 (12:51 -0700)]
auto merge of #8433 : brson/rust/rm-more-oldrt-crud, r=brson

Just deleting more stuff.

10 years agoauto merge of #8441 : erickt/rust/deny-warnings, r=erickt
bors [Sat, 17 Aug 2013 17:12:04 +0000 (10:12 -0700)]
auto merge of #8441 : erickt/rust/deny-warnings, r=erickt

This patch makes sure that code is warning-free for all of the rust libraries.

10 years agoDeny warnings in stage1+ libsyntax/librustc/librustdoc/librusti/librust
Erick Tryzelaar [Sat, 17 Aug 2013 15:37:12 +0000 (08:37 -0700)]
Deny warnings in stage1+ libsyntax/librustc/librustdoc/librusti/librust

10 years agoFix warnings it tests
Erick Tryzelaar [Sat, 17 Aug 2013 15:37:42 +0000 (08:37 -0700)]
Fix warnings it tests

10 years agoFix warnings in librustc and libsyntax
Erick Tryzelaar [Sat, 17 Aug 2013 15:37:07 +0000 (08:37 -0700)]
Fix warnings in librustc and libsyntax

10 years agoFix warnings in tests
Erick Tryzelaar [Sat, 17 Aug 2013 15:40:53 +0000 (08:40 -0700)]
Fix warnings in tests

10 years agoauto merge of #8272 : DaGenix/rust/digest-md5-impl-not-unrolled, r=cmr
bors [Sat, 17 Aug 2013 14:42:01 +0000 (07:42 -0700)]
auto merge of #8272 : DaGenix/rust/digest-md5-impl-not-unrolled, r=cmr

An MD5 implementation was originally included in #8097, but, since there are a couple different implementations of that digest algorithm (@alco mentioned his implementation on the mailing list just before I opened that PR), it was suggested that I remove it from that PR and open up a new PR to discuss the different implementations and the best way forward. If anyone wants to discuss a different implementation, feel free to present it here and discuss and compare it to this one. I'll just discuss my implementation and I'll leave it to others to present details of theirs.

This implementation relies on the FixedBuffer struct from cryptoutil.rs for managing the input buffer, just like the Sha1 and Sha2 digest implementations do. I tried manually unrolling the loops in the compression function, but I got slightly worse performance when I did that.

Outside of the #[test]s, I also tested the implementation by generating 1,000 inputs of up to 10MB in size and checking the MD5 digest calculated by this code against the MD5 digest calculated by Java's implementation.

On my computer, I'm getting the following performance:

```
test md5::bench::md5_10 ... bench: 52 ns/iter (+/- 1) = 192 MB/s
test md5::bench::md5_1k ... bench: 2819 ns/iter (+/- 44) = 363 MB/s
test md5::bench::md5_64k ... bench: 178566 ns/iter (+/- 4927) = 367 MB/s
```

10 years agoauto merge of #8053 : gavinb/rust/uuid_std, r=alexcrichton
bors [Sat, 17 Aug 2013 12:12:03 +0000 (05:12 -0700)]
auto merge of #8053 : gavinb/rust/uuid_std, r=alexcrichton

Addresses part of #7104

This module adds the ability to generate UUIDs (on all Rust-supported platforms).

I reviewed the existing UUID support in libraries for a range of languages; Go, D, C#, Java and Boost++. The features were all very similar, and this patch essentially covers the union.  The implmentation is quite straightforward, and uses the underlying rng support which is assumed to be sufficiently strong for this purpose.

This patch is not complete, however I have put this up for review to gather feedback before finalising. It has tests for most features and documentation for most functions.

Outstanding issues:

* Only generates V4 (Random) UUIDs. Do we want to support the SHA-1 hash based flavour as well?
* Is it worth having the field-based struct public as well as the byte array?
* Formatting the string with '-' between groups not done yet.
* Parsing full string not done as there appears to be no regexp support yet. I can write a simple manual parser for now?
* D has a generator as well. This would be easy to add. However, given the simple interface for creating a new one, and the presence of the macro, is this useful?
* Is it worth having a separate UUID trait and specific implementation? Or should it just have a struct+impl with the same name? Currently it feels weird to have the trait (which can't be named UUID so as to conflict) a separate thing.
* Should the macro be visible at the top level scope?

As this is a first attempt, some code may not be idiomatic. Please comment below...

Thanks for all feedback!

10 years agoauto merge of #8531 : brson/rust/test-waitpid-workaround, r=graydon
bors [Sat, 17 Aug 2013 07:22:05 +0000 (00:22 -0700)]
auto merge of #8531 : brson/rust/test-waitpid-workaround, r=graydon

...er

I believe the calls to waitpid are interacting badly with the message passing that goes
on between schedulers and causing us to have very little parallelism in
the test suite. I don't fully understand the sequence of events that causes
the problem here but clearly blocking on waitpid is something that a
well-behaved task should not be doing.

Unfortunately this adds quite a bit of overhead to each test: one thread, two
tasks, three stacks, so there's a tradeoff. The time to execute run-pass on
my 4-core machine goes from ~750s to ~300s.

This should have a pretty good impact on cycle times.

cc @toddaaro

10 years agoCrypto: Add tests for add_bytes_to_bits functions.
Palmer Cox [Wed, 14 Aug 2013 00:26:04 +0000 (20:26 -0400)]
Crypto: Add tests for add_bytes_to_bits functions.

10 years agoCrypto: update checked addition functions to use CheckedAdd intrinsic.
Palmer Cox [Mon, 12 Aug 2013 03:14:27 +0000 (23:14 -0400)]
Crypto: update checked addition functions to use CheckedAdd intrinsic.

The shift_add_check_overflow and shift_add_check_overflow_tuple functions are
re-written to be more efficient and to make use of the CheckedAdd instrinsic
instead of manually checking for integer overflow.

* The invokation leading_zeros() is removed and replaced with simple integer
  comparison. The leading_zeros() method results in a ctpop LLVM instruction
  and it may not be efficient on all architectures; integer comparisons,
  however, are efficient on just about any architecture.
* The methods lose the ability for the caller to specify a particular shift
  value - that functionality wasn't being used and removing it allows for the
  code to be simplified.
* Finally, the methods are renamed to add_bytes_to_bits and
  add_bytes_to_bits_tuple to reflect their very specific purposes.

10 years agoMD5: Create an implementation of MD5.
Palmer Cox [Fri, 2 Aug 2013 01:58:01 +0000 (21:58 -0400)]
MD5: Create an implementation of MD5.

10 years agoCrypto: Add little-endian versions of existing functions: read_u32v_le and write_u32_le.
Palmer Cox [Fri, 2 Aug 2013 02:07:36 +0000 (22:07 -0400)]
Crypto: Add little-endian versions of existing functions: read_u32v_le and write_u32_le.

10 years agoA round of code cleaning for the primary scheduler code. Comments have been updated...
toddaaro [Fri, 16 Aug 2013 02:46:23 +0000 (19:46 -0700)]
A round of code cleaning for the primary scheduler code. Comments have been updated, a minor amount of support type restructing has happened, methods have been reordered, and some duplicate code has been purged.

10 years agoMoved the logic for a pausible idle callback into a new type - PausibleIdleCallback...
toddaaro [Fri, 16 Aug 2013 20:41:30 +0000 (13:41 -0700)]
Moved the logic for a pausible idle callback into a new type - PausibleIdleCallback and placed the appropriate signatures in rtio and implementation into uvio.

10 years agostd::rt: Fix a race in UvRemoteCallback's dtor that misses callbacks
Brian Anderson [Fri, 16 Aug 2013 05:48:35 +0000 (22:48 -0700)]
std::rt: Fix a race in UvRemoteCallback's dtor that misses callbacks

Full description in comments.

10 years agostd::rt: Touch up idle logic
Brian Anderson [Fri, 16 Aug 2013 02:35:39 +0000 (19:35 -0700)]
std::rt: Touch up idle logic

10 years agoan attempt at a singleton pausible idle callback for each scheduler. suffers from...
toddaaro [Thu, 15 Aug 2013 18:13:41 +0000 (11:13 -0700)]
an attempt at a singleton pausible idle callback for each scheduler. suffers from nondeterministic deadlock and also pending scheduler messages on scheduler shutdown.

10 years agoDelegate `{}` to Default instead of Poly
Alex Crichton [Thu, 15 Aug 2013 03:40:15 +0000 (20:40 -0700)]
Delegate `{}` to Default instead of Poly

By using a separate trait this is overridable on a per-type basis and makes room
for the possibility of even more arguments passed in for the future.

10 years agoImplement `{:s}` for ~str and @str as well
Alex Crichton [Wed, 14 Aug 2013 23:47:14 +0000 (16:47 -0700)]
Implement `{:s}` for ~str and @str as well

10 years agoRemove obsolete error message regarding do-blocks with internal iters
Kevin Ballard [Fri, 16 Aug 2013 20:55:26 +0000 (13:55 -0700)]
Remove obsolete error message regarding do-blocks with internal iters

When using a `do` block to call an internal iterator, if you forgot to
return a value from the body, it would tell you

    error: Do-block body must return bool, but returns () here. Perhaps
    you meant to write a `for`-loop?

This advice no longer applies as `for` loops are now for external
iterators. Delete this message outright and let it use the default error
message

    error: mismatched types: expected `bool` but found `()`

10 years agodebuginfo: Added test cases for static struct and enum methods.
Michael Woerister [Fri, 16 Aug 2013 09:16:00 +0000 (11:16 +0200)]
debuginfo: Added test cases for static struct and enum methods.

10 years agodebuginfo: Test cases for [generic][default][static] methods and functions:
Michael Woerister [Thu, 15 Aug 2013 16:24:05 +0000 (18:24 +0200)]
debuginfo: Test cases for [generic][default][static] methods and functions:

* closure-in-generic-function
* generic-functions-nested
* generic-method-on-generic-struct
* generic-trait-generic-static-default-method
* method-on-generic-struct
* self-in-generic-default-method
* trait-generic-static-default-method

Also, fixed an 'unused variable' warning in debuginfo.rs

10 years agodebuginfo: Support for combinations of Self type and type parameters.
Michael Woerister [Thu, 15 Aug 2013 16:21:16 +0000 (18:21 +0200)]
debuginfo: Support for combinations of Self type and type parameters.

10 years agodebuginfo: Add test case for issue #8513.
Michael Woerister [Thu, 15 Aug 2013 10:35:08 +0000 (12:35 +0200)]
debuginfo: Add test case for issue #8513.

10 years agodebuginfo: Implemented support for Self type parameter in trait methods with default...
Michael Woerister [Thu, 15 Aug 2013 10:25:35 +0000 (12:25 +0200)]
debuginfo: Implemented support for Self type parameter in trait methods with default implementation.

10 years agodebuginfo: Added test cases for methods on structs, enums, traits, and tuple-structs.
Michael Woerister [Thu, 15 Aug 2013 10:23:54 +0000 (12:23 +0200)]
debuginfo: Added test cases for methods on structs, enums, traits, and tuple-structs.

Also new test cases for tuple structs and by-value parameter passing.

10 years agodebuginfo: Added support for self parameter in methods.
Michael Woerister [Thu, 15 Aug 2013 07:56:05 +0000 (09:56 +0200)]
debuginfo: Added support for self parameter in methods.

10 years agodebuginfo: Fixed crash occuring for parameterless closures.
Michael Woerister [Wed, 14 Aug 2013 13:45:38 +0000 (15:45 +0200)]
debuginfo: Fixed crash occuring for parameterless closures.

10 years agodebuginfo: Added test cases for generic structs and enums.
Michael Woerister [Tue, 13 Aug 2013 14:31:42 +0000 (16:31 +0200)]
debuginfo: Added test cases for generic structs and enums.

Also, always set no_monomorphic_collapse flags if debuginfo is generated.

10 years agodebuginfo: Properly handle monomorphization of generic functions.
Michael Woerister [Tue, 13 Aug 2013 10:52:39 +0000 (12:52 +0200)]
debuginfo: Properly handle monomorphization of generic functions.

10 years agodebuginfo: Generate template type parameters for generic functions.
Michael Woerister [Thu, 8 Aug 2013 16:33:06 +0000 (18:33 +0200)]
debuginfo: Generate template type parameters for generic functions.

Conflicts:
src/librustc/lib/llvm.rs
src/librustc/middle/trans/debuginfo.rs
src/rustllvm/RustWrapper.cpp
src/rustllvm/rustllvm.def.in

10 years agodebuginfo: Fixed option-like-enum test case so it does not rely on undefined behavior.
Michael Woerister [Thu, 8 Aug 2013 12:14:52 +0000 (14:14 +0200)]
debuginfo: Fixed option-like-enum test case so it does not rely on undefined behavior.

10 years agoReserve 'yield' keyword
Kevin Ballard [Fri, 16 Aug 2013 19:49:40 +0000 (12:49 -0700)]
Reserve 'yield' keyword

Rename task::yield() to task::deschedule().

Fixes #8494.

10 years agort: Remove unused uv helpers
Brian Anderson [Sat, 10 Aug 2013 07:34:28 +0000 (00:34 -0700)]
rt: Remove unused uv helpers

10 years agort: Remove empty rust_upcall.h
Brian Anderson [Sat, 10 Aug 2013 06:41:17 +0000 (23:41 -0700)]
rt: Remove empty rust_upcall.h

10 years agort: Remove unused rust_clone_type_desc declaration
Brian Anderson [Sat, 10 Aug 2013 06:39:29 +0000 (23:39 -0700)]
rt: Remove unused rust_clone_type_desc declaration