Commit Graph

955 Commits

Author SHA1 Message Date
Luqman Aden
1265a03139 librustc: Implement coercion for traits. 2013-12-27 03:26:46 -05:00
Patrick Walton
2fb33285e6 libextra: Stop using @mut MemWriter in the EBML module 2013-12-26 15:54:28 -08:00
Alex Crichton
ab431a20c0 Register new snapshots 2013-12-26 11:30:23 -08:00
Alex Crichton
6cad8f4f14 Test fixes and rebase conflicts
* vec::raw::to_ptr is gone
* Pausible => Pausable
* Removing @
* Calling the main task "<main>"
* Removing unused imports
* Removing unused mut
* Bringing some libextra tests up to date
* Allowing compiletest to work at stage0
* Fixing the bootstrap-from-c rmake tests
* assert => rtassert in a few cases
* printing to stderr instead of stdout in fail!()
2013-12-25 23:10:46 -08:00
Alex Crichton
7f48345904 std: Remove must deferred sending functions
These functions are all unnecessary now, and they only have meaning in the M:N
context. Removing these functions uncovered a bug in the librustuv timer
bindings, but it was fairly easy to cover (and the test is already committed).

These cannot be completely removed just yet due to their usage in the WaitQueue
of extra::sync, and until the mutex in libextra is rewritten it will not be
possible to remove the deferred sends for channels.
2013-12-24 19:59:54 -08:00
Alex Crichton
51abdee5f1 green: Rip the bandaid off, introduce libgreen
This extracts everything related to green scheduling from libstd and introduces
a new libgreen crate. This mostly involves deleting most of std::rt and moving
it to libgreen.

Along with the movement of code, this commit rearchitects many functions in the
scheduler in order to adapt to the fact that Local::take now *only* works on a
Task, not a scheduler. This mostly just involved threading the current green
task through in a few locations, but there were one or two spots where things
got hairy.

There are a few repercussions of this commit:

* tube/rc have been removed (the runtime implementation of rc)
* There is no longer a "single threaded" spawning mode for tasks. This is now
  encompassed by 1:1 scheduling + communication. Convenience methods have been
  introduced that are specific to libgreen to assist in the spawning of pools of
  schedulers.
2013-12-24 19:59:52 -08:00
Alex Crichton
a55c57284d std: Introduce std::sync
For now, this moves the following modules to std::sync

* UnsafeArc (also removed unwrap method)
* mpsc_queue
* spsc_queue
* atomics
* mpmc_bounded_queue
* deque

We may want to remove some of the queues, but for now this moves things out of
std::rt into std::sync
2013-12-24 14:42:00 -08:00
Jeff Olson
41cbbb656a extra: impl IterBytes for uuid::Uuid 2013-12-23 23:44:58 -08:00
Alex Crichton
f9b231cd08 Fixing more doc tests 2013-12-23 09:10:37 -08:00
Alex Crichton
d882b1d4f9 extra: Fix all code examples 2013-12-23 09:10:36 -08:00
bors
1b4bbc89b3 auto merge of #11109 : sfackler/rust/arc, r=alexcrichton
Closes #11097
2013-12-22 16:56:31 -08:00
bors
0c0c492101 auto merge of #11101 : jhasse/rust/patch-msys-quickfix, r=luqmana
I had this fixed but somehow forgot to commit it in my final patch. Sorry!
2013-12-22 13:51:35 -08:00
bors
55cbef611a auto merge of #11064 : huonw/rust/vec-sort, r=alexcrichton
This uses quite a bit of unsafe code for speed and failure safety, and allocates `2*n` temporary storage.

[Performance](https://gist.github.com/huonw/5547f2478380288a28c2):

|      n |      new | priority_queue |   quick3 |
|-------:|---------:|---------------:|---------:|
|      5 |      200 |            155 |      106 |
|    100 |     6490 |           8750 |     5810 |
|  10000 |  1300000 |        1790000 |  1060000 |
| 100000 | 16700000 |       23600000 | 12700000 |
| sorted |   520000 |        1380000 | 53900000 |
|  trend |  1310000 |        1690000 |  1100000 |

(The times are in nanoseconds, having subtracted the set-up time (i.e. the `just_generate` bench target).)

I imagine that there is still significant room for improvement, particularly because both priority_queue and quick3 are doing a static call via `Ord` or `TotalOrd` for the comparisons, while this is using a (boxed) closure.

Also, this code does not `clone`, unlike `quick_sort3`; and is stable, unlike both of the others.
2013-12-22 00:41:39 -08:00
Huon Wilson
2e8c522c62 std::vec: make the sorting closure use Ordering rather than just being
(implicitly) less_eq.
2013-12-22 18:16:50 +11:00
Steven Fackler
2490b59da0 Remove unneccessary mut from arc 2013-12-21 21:10:45 -07:00
Steven Fackler
7a1e486b2a Don't poison ARCs that are used while unwinding
Closes #11097
2013-12-21 20:53:43 -07:00
Jan Niklas Hasse
5746e0cd2a Remove unnecessary semicolon 2013-12-21 17:31:24 +01:00
bors
45d24a5f7c auto merge of #11031 : jhasse/rust/patch-msys-3, r=cmr
Enable ANSI colors if TERM is set to cygwin and terminfo is not available (msys terminal on Windows). See #2807
2013-12-20 17:31:51 -08:00
Huon Wilson
1b1e4caa79 std::vec: add a sugary .sort() method for plain Ord sorting.
This moves the custom sorting to `.sort_by`.
2013-12-21 09:35:18 +11:00
Jan Niklas Hasse
5cf2f54bb1 Support ANSI colors in msys terminals. See #2807 2013-12-20 22:32:27 +01:00
bors
415e55a02c auto merge of #11071 : huonw/rust/quiet-test, r=cmr 2013-12-19 18:51:39 -08:00
Huon Wilson
48fedcb36f extra: remove sort in favour of the std method.
Fixes #9676.
2013-12-20 12:38:46 +11:00
bors
5c24bfa8c3 auto merge of #11057 : alexcrichton/rust/no-at-in-ebml, r=pcwalton
Now that the metadata is an owned value with a lifetime of a borrowed byte
slice, it's possible to have future optimizations where the metadata doesn't
need to be copied around (very expensive operation).
2013-12-19 17:11:40 -08:00
Alex Crichton
73fceca7d6 Purge @-boxes from the reading half of EBML
Now that the metadata is an owned value with a lifetime of a borrowed byte
slice, it's possible to have future optimizations where the metadata doesn't
need to be copied around (very expensive operation).
2013-12-19 17:08:05 -08:00
bors
d760f994de auto merge of #11041 : cmr/rust/pkgid_changes, r=cmr,metajack 2013-12-19 07:51:36 -08:00
Corey Richardson
dee1107571 Rename pkgid to crate_id
Closes #11035
2013-12-19 10:10:23 -05:00
Huon Wilson
f13d57f8d3 extra: silence warnings during testing. 2013-12-20 01:26:03 +11:00
bors
b4ed6f9695 auto merge of #10927 : g3xzh/rust/sum_bugfix, r=huonw
`[1e20, 1.0, -1e20].sum()` returns `0.0`. This happens because during
the summation, `1.0` is too small relative to `1e20`, making it
negligible.

I have tried Kahan summation but it hasn't fixed the problem.
Therefore, I've used Python's `fsum()` implementation.
For more details, read:
www.cs.cmu.edu/~quake-papers/robust-arithmetic.ps
https://github.com/mozilla/rust/issues/10851

Python's fsum (msum)
http://code.activestate.com/recipes/393090/

@huonw, your feedback is more than welcome.
It looks unpolished; Do you have suggestions how to make it more beautiful and elegant?

Thanks in advance,
2013-12-18 18:41:35 -08:00
bors
3c2c13bae4 auto merge of #11029 : huonw/rust/rm-vec-as-buf, r=cmr
For `str.as_mut_buf`, un-closure-ification is achieved by outright removal (see commit message). The others are replaced by `.as_ptr`, `.as_mut_ptr` and `.len`
2013-12-18 17:11:42 -08:00
g3xzh
05395cba88 Fix sum() accuracy
`[1e20, 1.0, -1e20].sum()` returns `0.0`. This happens because during
the summation, `1.0` is too small relative to `1e20`, making it
negligible.

I have tried Kahan summation but it hasn't fixed the problem.
Therefore, I've used Python's `fsum()` implementation with some
help from Jason Fager and Huon Wilson.
For more details, read:
www.cs.cmu.edu/~quake-papers/robust-arithmetic.ps

Moreover, benchmark and unit tests were added.

Note: `Status.sum` is still not fully fixed. It doesn't handle
NaNs, infinities and overflow correctly. See issue 11059:
https://github.com/mozilla/rust/issues/11059
2013-12-19 02:13:51 +02:00
Huon Wilson
4c79b22ef2 std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.
There's no need for the restrictions of a closure with the above methods.
2013-12-19 09:26:13 +11:00
Alex Crichton
eabf11b9cb Don't allow impls to force public types
This code in resolve accidentally forced all types with an impl to become
public. This fixes it by default inheriting the privacy of what was previously
there and then becoming `true` if nothing else exits.

Closes #10545
2013-12-17 09:38:57 -08:00
bors
793eb1d38d auto merge of #10996 : huonw/rust/more-vec-raw, r=cmr
The removal of the aliasing &mut[] and &[] from `shift_opt` also comes with its simplification.

The above also allows the use of `copy_nonoverlapping_memory` in `[].copy_memory` (I did an audit of each use of `.copy_memory` and `std::vec::bytes::copy_memory`, and I believe none of them are called with arguments can ever alias). This changes requires that `unsafe` code using `copy_memory` **needs** to respect the aliasing rules of `&mut[]`.
2013-12-17 03:51:40 -08:00
Alex Crichton
39a6c9d637 Test fallout from std::comm rewrite 2013-12-16 22:55:49 -08:00
Alex Crichton
529e268ab9 Fallout of rewriting std::comm 2013-12-16 17:47:11 -08:00
Huon Wilson
d0ae820765 std::vec::raw: convert copy_memory to a method. 2013-12-17 08:36:01 +11:00
Alex Crichton
d9ea475feb Register new snapshots
Understand 'pkgid' in stage0. As a bonus, the snapshot now contains now metadata
(now that those changes have landed), and the snapshot download is half as large
as it used to be!
2013-12-15 22:17:59 -08:00
bors
8d52dfbace auto merge of #10984 : huonw/rust/clean-raw, r=cmr
See commits for details.
2013-12-15 06:56:27 -08:00
Huon Wilson
164f7a290e std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut []. 2013-12-15 23:37:41 +11:00
Huon Wilson
f97040a93b std::vec: remove unnecessary count parameter on {bytes,
raw}::copy_memory.

Slices carry their length with them, so we can just use that
information.
2013-12-15 22:23:11 +11:00
Huon Wilson
b0bcbbb154 extra: fix spelling in docs. 2013-12-15 16:34:14 +11:00
bors
ca54ad8592 auto merge of #10952 : huonw/rust/1ms-bench, r=cmr
This makes sure we always run benchmarks even if they are predicted to
take a long time, so that we have some non-zero time to display
(although the error bars may be huge for particularly slow benchmarks).

Fixes #9532.
2013-12-14 14:11:21 -08:00
bors
844003683b auto merge of #10931 : sfackler/rust/base64-visibility, r=alexcrichton
These got swept up in the great privatizing of 2013.
2013-12-14 00:56:31 -08:00
bors
67177ef3e1 auto merge of #10923 : boredomist/rust/export-summary-members, r=alexcrichton
Several of the members of `extra::stats::Summary` were calculated and tested, but not exposed externally. This change exposes all of the members.
2013-12-13 20:01:44 -08:00
Brian Anderson
df1aa7ecd2 Ignore time tests on android. #10958 2013-12-13 16:39:20 -08:00
Huon Wilson
79739d96f7 extra::test: handle slow benchmarks more gracefully.
This makes sure we always run benchmarks even if they are predicted to
take a long time, so that we have some non-zero time to display
(although the error bars may be huge for particularly slow benchmarks).

Fixes #9532.
2013-12-13 23:18:55 +11:00
Steven Fackler
9762698b96 Make base64::config fields public again
These got swept up in the great privatizing of 2013.
2013-12-11 19:27:20 -08:00
Erik Price
07e18597bd Make priv members of extra::stats::Summary public. 2013-12-11 12:36:17 -08:00
Erik Price
5731ca3078 Make 'self lifetime illegal.
Also remove all instances of 'self within the codebase.

This fixes #10889.
2013-12-11 10:54:06 -08:00
bors
b8b16ae099 auto merge of #10791 : pcwalton/rust/decelling, r=pcwalton
34 uses of `Cell` remain.

r? @alexcrichton
2013-12-10 19:16:19 -08:00