Commit Graph

24623 Commits

Author SHA1 Message Date
bors
ac28718f73 auto merge of #11038 : alexcrichton/rust/fix-osx-leak, r=cmr
I haven't landed this fix upstream just yet, but it's opened as
joyent/libuv#1048. For now, I've locally merged it into my fork, and I've
upgraded our repo to point to the new revision.

Closes #11027
2013-12-19 00:16:35 -08:00
Alex Crichton
9578af8876 Upgrade libuv to fix a leak on OSX
I haven't landed this fix upstream just yet, but it's opened as
joyent/libuv#1048. For now, I've locally merged it into my fork, and I've
upgraded our repo to point to the new revision.

Closes #11027
2013-12-18 23:00:04 -08:00
bors
52769b6180 auto merge of #11050 : alexcrichton/rust/snapshots, r=brson
Time for a visit from the snapshot fairy!
2013-12-18 22:41:36 -08:00
Huon Wilson
cacf58caff std::str: fix .slice_chars example. Fixes #11014. 2013-12-19 17:36:44 +11:00
bors
b760ed6573 auto merge of #10977 : brson/rust/androidtest, r=brson
#10975

For a while I thought the android test bot was succeeding but it wasn't really testing anything at all.
2013-12-18 20:06:33 -08:00
Huon Wilson
81632513c1 std::vec: replace .insert with a small amount of unsafe code.
This makes the included benchmark more than 3 times faster. Also,
`.unshift(x)` is now faster as `.insert(0, x)` which can reuse the
allocation if necessary.
2013-12-19 14:00:44 +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
Brian Anderson
4a03e04755 Make Android tests fail if no device is available 2013-12-18 18:12:46 -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
Cadence Marseille
f24787dbfb Fix #10755 - ICE: --linker=
Trap the io_error condition so that a more informative error message is
displayed when the linker program cannot be started, such as when the
name of the linker binary is accidentally mistyped.

closes #10755
2013-12-18 18:33:33 -05:00
Huon Wilson
b906a8b256 std::str: remove .as_mut_buf & rewrite/simplify .push_char.
`.as_mut_buf` was used exactly once, in `.push_char` which could be
written in a simpler way, using the `&mut ~[u8]` that it already
retrieved. In the rare situation when someone really needs
`.as_mut_buf`-like functionality (getting a `*mut u8`), they can go via
`str::raw::as_owned_vec`.
2013-12-19 10:18:02 +11:00
Huon Wilson
17ac2aa523 std::str: replace .as_imm_buf with .as_ptr. 2013-12-19 10:18:02 +11:00
Huon Wilson
9177f7ecb4 std::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len. 2013-12-19 10:18:02 +11:00
bors
b6933f8d8b auto merge of #11032 : cmr/rust/rustdoc_test, r=alexcrichton
This is just a smoke test which verifies that the expected files are
generated.
2013-12-18 15:16:39 -08: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
Corey Richardson
21bec4f11b rustdoc: thread through the context for rendering
This partially reverts 8b5a317.
2013-12-18 15:21:34 -05:00
Corey Richardson
5d45170b02 Add a rustdoc test
This is just a smoke test which verifies that the expected files are
generated. Also makes the rmake tests have the right deps.
2013-12-18 15:21:30 -05:00
bors
c87b9d37f7 auto merge of #11013 : klutzy/rust/win-no-pthread, r=alexcrichton
llvm supports both win32 native threads and pthread,
but configure tries to find pthread first.
This manually disables pthread to use native api.

This removes libpthreads-2.dll dependency on librustc.
2013-12-18 12:16:35 -08:00
bors
6d2e61bc6c auto merge of #11012 : alexcrichton/rust/needstest, r=alexcrichton
Closes #5806
Closes #8259
Closes #8578
Closes #8851
Closes #10412
2013-12-18 10:36:51 -08:00
Alex Crichton
d4825b92bc Register new snapshots
Time for a visit from the snapshot fairy!
2013-12-18 09:32:03 -08:00
Alex Crichton
3e04d2e3db Adding tests for closed issues
Closes #5806
Closes #5950
Closes #7178
Closes #8259
Closes #8578
Closes #8851
Closes #9129
Closes #10412
2013-12-18 09:12:04 -08:00
bors
5ece092773 auto merge of #11033 : michaelwoerister/rust/byvalself, r=pcwalton
As the title says. The trans changes will lead to an auxiliary alloca being created that allows debug info to track the `self` argument. This alloca is only created in debug builds however. Otherwise very little had to be done after I managed to navigate to some degree the jungle that is self-argument handling `:P` 

Closes #10549
2013-12-18 08:36:36 -08:00
bors
c33573440b auto merge of #11024 : huonw/rust/return-from-closures, r=alexcrichton
With the old `for` gone, this behaviour is no longer conflicting with
that use of `return` in closures, and this allows shortcircuiting in a
closure.
2013-12-18 06:26:33 -08:00
bors
5cea7db2a5 auto merge of #10915 : alexcrichton/rust/fixes, r=ILyoan
Just a little cleanup.
2013-12-18 05:01:47 -08:00
Huon Wilson
6876916a45 rustc: Allow return to return from a closure.
With the old `for` gone, this behaviour is no longer conflicting with
that use of `return` in closures, and this allows shortcircuiting in a
closure.
2013-12-18 22:53:45 +11:00
bors
f43402fd66 auto merge of #11025 : ezyang/rust/reword-second-borrow, r=cmr
When a borrow occurs twice illegally, Rust will label the other borrow
as the "second borrow".  This is quite confusing, as the "second borrow"
usually happened before the flagged barrow (e.g. as far as dataflow
is concerned, the first borrow is OK, the second borrow is illegal.)
This patch renames "second borrow" to "previous borrow", to make the
spatial relationship between the two borrows clearer.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-18 03:36:33 -08:00
bors
1fee5cd953 auto merge of #11018 : sfackler/rust/variant-strip, r=alexcrichton
Previously, if every variant was private, it would display as a
variantless enum instead of having the "some variants stripped" comment.
2013-12-17 23:51:34 -08:00
bors
09b8406638 auto merge of #11019 : alexcrichton/rust/issue-10545, r=pcwalton
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 21:31:47 -08:00
klutzy
b0a9937a6d mklldeps.py: Write to file instead of print
It seems that msys automatically converts `\n` to `\r\n` on pipe
redirection, which causes `make tidy` failure.
2013-12-18 09:49:55 +09:00
klutzy
1890290ded llvm: Disable pthread on mingw
llvm supports both win32 native threads and pthread,
but configure tries to find pthread first.
This manually disables pthread to use native api.

This removes libpthreads-2.dll dependency on librustc.
2013-12-18 09:48:58 +09:00
bors
ac137f6dbe auto merge of #11009 : ktt3ja/rust/issue-11006, r=alexcrichton
Fix #11006.
2013-12-17 15:51:35 -08:00
bors
bf30a213c4 auto merge of #10967 : chris-morgan/rust/clean-and-tidy-some-traits, r=alexcrichton
### Remove {As,Into,To}{Option,Either,Result} traits.

Expanded, that is:

- `AsOption`
- `IntoOption`
- `ToOption`
- `AsEither`
- `IntoEither`
- `ToEither`
- `AsResult`
- `IntoResult`
- `ToResult`

These were defined for each other but never *used* anywhere. They are
all trivial and so removal will have negligible effect upon anyone.
`Either` has fallen out of favour (and its implementation of these
traits of dubious semantics), `Option<T>` → `Result<T, ()>` was never
really useful and `Result<T, E>` → `Option<T>` should now be done with
`Result.ok()` (mirrored with `Result.err()` for even more usefulness).

In summary, there's really no point in any of these remaining.

### Rename To{Str,Bytes}Consume traits to Into*.

That is:

- `ToStrConsume` → `IntoStr`;
- `ToBytesConsume` → `IntoBytes`.
2013-12-17 12:56:39 -08:00
bors
3272b002b3 auto merge of #10979 : alexcrichton/rust/less-bc, r=cmr
By performing this logic very late in the build process, it ended up leading to
bugs like those found in #10973 where certain stages of the build process
expected a particular output format which didn't end up being the case. In order
to fix this, the build output generation is moved very early in the build
process to the absolute first thing in phase 2.

Closes #10973
2013-12-17 11:36:42 -08:00
bors
fe85856dc9 auto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichton
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-17 10:21:44 -08: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
Michael Woerister
01fae5fb2a debuginfo: Updated test cases to also test by-value self arguments. 2013-12-17 18:08:51 +01:00
Michael Woerister
0f98cb4198 debuginfo: Properly support by-value self arguments 2013-12-17 18:08:42 +01:00
bors
b870ce7a9f auto merge of #11030 : cmr/rust/rustdoc_on_fire, r=metajack
By returning the items to process and storing them in a queue, we were losing
the context that was setup for that item during the recursion. This is an easy
fix, rather than hoisting out the state that it needs.
2013-12-17 09:01:58 -08:00
Corey Richardson
8b5a317d48 Fix rustdoc HTML rendering
By returning the items to process and storing them in a queue, we were losing
the context that was setup for that item during the recursion. This is an easy
fix, rather than hoisting out the state that it needs.
2013-12-17 11:19:14 -05:00
bors
d5798b3902 auto merge of #10972 : metajack/rust/pkgid-with-name, r=alexcrichton
This change extends the pkgid attribute to allow of explicit crate names, instead of always inferring them based on the path. This means that if your GitHub repo is called `rust-foo`, you can have your pkgid set your library name to `foo`. You'd do this with a pkgid attribute like `github.com/somewhere/rust-foo#foo:1.0`.

This is half of the fix for #10922.
2013-12-17 07:41:40 -08:00
Jack Moffitt
262cc4a2bc Update docs to new syntax. 2013-12-17 07:41:39 -07:00
Jack Moffitt
66e049e3af Change pkgid parser to allow overriding the inferred crate name.
Previously the a pkgid of `foo/rust-bar#1.0` implied a crate name of
`rust-bar` and didn't allow this to be overridden. Now you can override the
inferred crate name with `foo/rust-bar#bar:1.0`.
2013-12-17 07:41:39 -07:00
bors
1a26bd166a auto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton
There is no `~mut T` and `[mut T]` any more.
2013-12-17 06:26:40 -08:00
bors
fb6ec38352 auto merge of #10998 : thestinger/rust/iter, r=alexcrichton 2013-12-17 05:11:41 -08:00
Edward Z. Yang
4584acdf4c s/Second borrow/Previous borrow/ in error messages.
When a borrow occurs twice illegally, Rust will label the other borrow
as the "second borrow".  This is quite confusing, as the "second borrow"
usually happened before the flagged borrow (e.g. as far as dataflow
is concerned, the first borrow is OK, the second borrow is illegal.)
This patch renames "second borrow" to "previous borrow", to make the
spatial relationship between the two borrows clearer.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-17 21:10:57 +08:00
Cadence Marseille
33ca3e35be Handle ENOENT
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-17 08:08:19 -05: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
bors
dc65762d79 auto merge of #10990 : ktt3ja/rust/method-stability, r=huonw
If it's a trait method, this checks the stability attribute of the
method inside the trait definition. Otherwise, it checks the method
implementation itself.

Close #8961.
2013-12-17 02:31:55 -08:00
bors
47c9a35747 auto merge of #10830 : alexcrichton/rust/spsc-queue, r=brson
This pull request completely rewrites std::comm and all associated users. Some major bullet points

* Everything now works natively
* oneshots have been removed
* shared ports have been removed
* try_recv no longer blocks (recv_opt blocks)
* constructors are now Chan::new and SharedChan::new
* failure is propagated on send
* stream channels are 3x faster

I have acquired the following measurements on this patch. I compared against Go, but remember that Go's channels are fundamentally different than ours in that sends are by-default blocking. This means that it's not really a totally fair comparison, but it's good to see ballpark numbers for anyway

```
          oneshot         stream          shared1
std         2.111           3.073          1.730 
my          6.639           1.037          1.238 
native      5.748           1.017          1.250 
go8         1.774           3.575          2.948 
go8-inf     slow            0.837          1.376 
go8-128     4.832           1.430          1.504 
go1         1.528           1.439          1.251 
go2         1.753           3.845          3.166 
```

I had three benchmarks:

* oneshot - N times, create a "oneshot channel", send on it, then receive on it (no task spawning)
* stream - N times, send from one task to another task, wait for both to complete
* shared1 - create N threads, each of which sends M times, and a port receives N*M times.

The rows are as follows:

* `std` - the current libstd implementation (before this pull request)
* `my` - this pull request's implementation (in M:N mode)
* `native` - this pull request's implementation (in 1:1 mode)
* `goN` - go's implementation with GOMAXPROCS=N. The only relevant value is 8 (I had 8 cores on this machine)
* `goN-X` - go's implementation where the channels in question were created with buffers of size `X` to behave more similarly to rust's channels.
2013-12-17 01:16:43 -08:00