]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #11110 : alexcrichton/rust/attempt-to-fix-osx-segfaulting, r=brson
bors [Sun, 22 Dec 2013 05:01:51 +0000 (21:01 -0800)]
auto merge of #11110 : alexcrichton/rust/attempt-to-fix-osx-segfaulting, r=brson

Upon inspecting the core dumps, they're all segfaulting at the same instruction
with the same value in a register that looks fishy. It appears to be indexing
into an array with a -1 index and then getting some weird overflow and dying.

I have attempted to fix this as part of
alexcrichton/libuv@fd5308383c575472edb2163d823dc6670bf59609,
but I am unsure of whether this is the actual cause of the problem, so I am not
going to upstream it just yet. I have a fairly high confidence that this is
indeed the problem, but I want to make sure that the bots to segfault all over
the place before upstreaming.

10 years agoAttempt to fix the segfaulting osx bots
Alex Crichton [Sun, 22 Dec 2013 04:17:23 +0000 (20:17 -0800)]
Attempt to fix the segfaulting osx bots

Upon inspecting the core dumps, they're all segfaulting at the same instruction
with the same value in a register that looks fishy. It appears to be indexing
into an array with a -1 index and then getting some weird overflow and dying.

I have attempted to fix this as part of
alexcrichton/libuv@fd5308383c575472edb2163d823dc6670bf59609,
but I am unsure of whether this is the actual cause of the problem, so I am not
going to upstream it just yet. I have a fairly high confidence that this is
indeed the problem, but I want to make sure that the bots to segfault all over
the place before upstreaming.

10 years agoauto merge of #11095 : brson/rust/issue-11094, r=alexcrichton
bors [Sun, 22 Dec 2013 03:46:35 +0000 (19:46 -0800)]
auto merge of #11095 : brson/rust/issue-11094, r=alexcrichton

10 years agoauto merge of #11100 : klutzy/rust/win-no-pthread-2, r=alexcrichton
bors [Sat, 21 Dec 2013 08:56:30 +0000 (00:56 -0800)]
auto merge of #11100 : klutzy/rust/win-no-pthread-2, r=alexcrichton

10 years agorustuv: Stop link to pthread on Windows
klutzy [Sat, 21 Dec 2013 06:42:01 +0000 (15:42 +0900)]
rustuv: Stop link to pthread on Windows

10 years agoauto merge of #10930 : DaGenix/rust/remove-unnecessary-fields, r=alexcrichton
bors [Sat, 21 Dec 2013 04:01:41 +0000 (20:01 -0800)]
auto merge of #10930 : DaGenix/rust/remove-unnecessary-fields, r=alexcrichton

3 minor clean-ups now that #9629 is fixed:

* Update MutChunkIter to remove the ```remainder``` that existed just to allow the size_hint() method to be implemented. This is no longer necessary since we can just access the length of the slice directly.
* Update MutSplitIterator to address the FIXME in its size_hint() method. This method was only partially implemented due to the issue. Also, implement a minor optimization in the case that its the last iteration.
* Update ByRef iterator to implement the size_hint() method.

I noticed that MutSplitIterator returns an empty slice if called on an empty slice. I don't know if this is intended or not, but I left the ```finished``` field in-place to preserve this behavior.

@TeXitoi @blake2-ppc

10 years agoauto merge of #11079 : chris-morgan/rust/fix-11072-regressions, r=brson
bors [Sat, 21 Dec 2013 02:46:31 +0000 (18:46 -0800)]
auto merge of #11079 : chris-morgan/rust/fix-11072-regressions, r=brson

(#11072)

There, concrete evidence that I shouldn't try doing such things at 1:30am.

10 years agomk: Work around problem with run-make tests on multiple targets. #11094
Brian Anderson [Sat, 21 Dec 2013 02:06:12 +0000 (18:06 -0800)]
mk: Work around problem with run-make tests on multiple targets. #11094

10 years agoImplement size_hint() for ByRef iterator
Palmer Cox [Thu, 12 Dec 2013 02:37:45 +0000 (21:37 -0500)]
Implement size_hint() for ByRef iterator

10 years agoUpdate next() and size_hint() for MutSpliterIterator
Palmer Cox [Thu, 12 Dec 2013 01:51:22 +0000 (20:51 -0500)]
Update next() and size_hint() for MutSpliterIterator

Update the next() method to just return self.v in the case that we've reached
the last element that the iterator will yield. This produces equivalent
behavior as before, but without the cost of updating the field.

Update the size_hint() method to return a better hint now that #9629 is fixed.

10 years agoRemove remainder field from MutChunkIter
Palmer Cox [Thu, 12 Dec 2013 01:40:27 +0000 (20:40 -0500)]
Remove remainder field from MutChunkIter

This field is no longer necessary now that #9629 is fixed since we can just
access the length of the remaining slice directly.

10 years agoauto merge of #11031 : jhasse/rust/patch-msys-3, r=cmr
bors [Sat, 21 Dec 2013 01:31:51 +0000 (17:31 -0800)]
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

10 years agoauto merge of #11077 : alexcrichton/rust/crate-id, r=cmr
bors [Fri, 20 Dec 2013 23:21:33 +0000 (15:21 -0800)]
auto merge of #11077 : alexcrichton/rust/crate-id, r=cmr

Right now the --crate-id and related flags are all process *after* the entire
crate is parsed. This is less than desirable when used with makefiles because it
means that just to learn the output name of the crate you have to parse the
entire crate (unnecessary).

This commit changes the behavior to lift the handling of these flags much sooner
in the compilation process. This allows us to not have to parse the entire crate
and only have to worry about parsing the crate attributes themselves. The
related methods have all been updated to take an array of attributes rather than
a crate.

Additionally, this ceases duplication of the "what output are we producing"
logic in order to correctly handle things in the case of --test.

Finally, this adds tests for all of this functionality to ensure that it does
not regress.

10 years agoSupport ANSI colors in msys terminals. See #2807
Jan Niklas Hasse [Fri, 20 Dec 2013 19:22:41 +0000 (20:22 +0100)]
Support ANSI colors in msys terminals. See #2807

10 years agoauto merge of #10986 : adridu59/rust/patch-new, r=alexcrichton
bors [Fri, 20 Dec 2013 20:41:33 +0000 (12:41 -0800)]
auto merge of #10986 : adridu59/rust/patch-new, r=alexcrichton

Thanks to @huonw for some mentoring. :cake:

10 years agodoc: forward-port the conditions tutorial + fixup libstd example
Adrien Tétar [Sun, 15 Dec 2013 15:19:13 +0000 (16:19 +0100)]
doc: forward-port the conditions tutorial + fixup libstd example

10 years agoauto merge of #11075 : alexcrichton/rust/issue-10392, r=brson
bors [Fri, 20 Dec 2013 17:11:33 +0000 (09:11 -0800)]
auto merge of #11075 : alexcrichton/rust/issue-10392, r=brson

We decided in the 12/10/13 weekly meeting that trailing commas should be
accepted pretty much anywhere. They are currently not allowed in struct
patterns, and this commit adds support for that.

Closes #10392

10 years agorustc: Improve crate id extraction
Alex Crichton [Thu, 19 Dec 2013 20:23:39 +0000 (12:23 -0800)]
rustc: Improve crate id extraction

Right now the --crate-id and related flags are all process *after* the entire
crate is parsed. This is less than desirable when used with makefiles because it
means that just to learn the output name of the crate you have to parse the
entire crate (unnecessary).

This commit changes the behavior to lift the handling of these flags much sooner
in the compilation process. This allows us to not have to parse the entire crate
and only have to worry about parsing the crate attributes themselves. The
related methods have all been updated to take an array of attributes rather than
a crate.

Additionally, this ceases duplication of the "what output are we producing"
logic in order to correctly handle things in the case of --test.

Finally, this adds tests for all of this functionality to ensure that it does
not regress.

10 years agoauto merge of #11081 : alexcrichton/rust/comm-adapters, r=huonw
bors [Fri, 20 Dec 2013 12:36:32 +0000 (04:36 -0800)]
auto merge of #11081 : alexcrichton/rust/comm-adapters, r=huonw

I accidentally removed this module from compilation awhile back, this adds it
back in.

Closes #11076

10 years agoauto merge of #11017 : alexcrichton/rust/faster-read, r=thestinger
bors [Fri, 20 Dec 2013 10:06:34 +0000 (02:06 -0800)]
auto merge of #11017 : alexcrichton/rust/faster-read, r=thestinger

We were previously reading metadata via `ar p`, but as learned from rustdoc
awhile back, spawning a process to do something is pretty slow. Turns out LLVM
has an Archive class to read archives, but it cannot write archives.

This commits adds bindings to the read-only version of the LLVM archive class
(with a new type that only has a read() method), and then it uses this class
when reading the metadata out of rlibs. When you put this in tandem of not
compressing the metadata, reading the metadata is 4x faster than it used to be
The timings I got for reading metadata from the respective libraries was:

    libstd-04ff901e-0.9-pre.dylib    => 100ms
    libstd-04ff901e-0.9-pre.rlib     => 23ms
    librustuv-7945354c-0.9-pre.dylib => 4ms
    librustuv-7945354c-0.9-pre.rlib  => 1ms
    librustc-5b94a16f-0.9-pre.dylib  => 87ms
    librustc-5b94a16f-0.9-pre.rlib   => 35ms
    libextra-a6ebb16f-0.9-pre.dylib  => 63ms
    libextra-a6ebb16f-0.9-pre.rlib   => 15ms
    libsyntax-2e4c0458-0.9-pre.dylib => 86ms
    libsyntax-2e4c0458-0.9-pre.rlib  => 22ms

In order to always take advantage of these faster metadata read-times, I sort
the files in filesearch based on whether they have an rlib extension or not
(prefer all rlib files first).

Overall, this halved the compile time for a `fn main() {}` crate from 0.185s to
0.095s on my system (when preferring dynamic linking). Reading metadata is still
the slowest pass of the compiler at 0.035s, but it's getting pretty close to
linking at 0.021s! The next best optimization is to just not copy the metadata
from LLVM because that's the most expensive part of reading metadata right now.

10 years agorustc: Optimize reading metadata by 4x
Alex Crichton [Tue, 17 Dec 2013 04:58:21 +0000 (20:58 -0800)]
rustc: Optimize reading metadata by 4x

We were previously reading metadata via `ar p`, but as learned from rustdoc
awhile back, spawning a process to do something is pretty slow. Turns out LLVM
has an Archive class to read archives, but it cannot write archives.

This commits adds bindings to the read-only version of the LLVM archive class
(with a new type that only has a read() method), and then it uses this class
when reading the metadata out of rlibs. When you put this in tandem of not
compressing the metadata, reading the metadata is 4x faster than it used to be
The timings I got for reading metadata from the respective libraries was:

    libstd-04ff901e-0.9-pre.dylib    => 100ms
    libstd-04ff901e-0.9-pre.rlib     => 23ms
    librustuv-7945354c-0.9-pre.dylib => 4ms
    librustuv-7945354c-0.9-pre.rlib  => 1ms
    librustc-5b94a16f-0.9-pre.dylib  => 87ms
    librustc-5b94a16f-0.9-pre.rlib   => 35ms
    libextra-a6ebb16f-0.9-pre.dylib  => 63ms
    libextra-a6ebb16f-0.9-pre.rlib   => 15ms
    libsyntax-2e4c0458-0.9-pre.dylib => 86ms
    libsyntax-2e4c0458-0.9-pre.rlib  => 22ms

In order to always take advantage of these faster metadata read-times, I sort
the files in filesearch based on whether they have an rlib extension or not
(prefer all rlib files first).

Overall, this halved the compile time for a `fn main() {}` crate from 0.185s to
0.095s on my system (when preferring dynamic linking). Reading metadata is still
the slowest pass of the compiler at 0.035s, but it's getting pretty close to
linking at 0.021s! The next best optimization is to just not copy the metadata
from LLVM because that's the most expensive part of reading metadata right now.

10 years agoauto merge of #11073 : klutzy/rust/issue-10978, r=alexcrichton
bors [Fri, 20 Dec 2013 04:06:36 +0000 (20:06 -0800)]
auto merge of #11073 : klutzy/rust/issue-10978, r=alexcrichton

This patchset fixes small glitches which caused #10978.

10 years agoauto merge of #11071 : huonw/rust/quiet-test, r=cmr
bors [Fri, 20 Dec 2013 02:51:39 +0000 (18:51 -0800)]
auto merge of #11071 : huonw/rust/quiet-test, r=cmr

10 years agoauto merge of #11057 : alexcrichton/rust/no-at-in-ebml, r=pcwalton
bors [Fri, 20 Dec 2013 01:11:40 +0000 (17:11 -0800)]
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).

10 years agoPurge @-boxes from the reading half of EBML
Alex Crichton [Wed, 18 Dec 2013 22:10:28 +0000 (14:10 -0800)]
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).

10 years agoGet comm_adapters building again
Alex Crichton [Thu, 19 Dec 2013 23:42:44 +0000 (15:42 -0800)]
Get comm_adapters building again

I accidentally removed this module from compilation awhile back, this adds it
back in.

Closes #11076

10 years agoauto merge of #11060 : pcwalton/rust/tydecode-pod, r=pcwalton
bors [Thu, 19 Dec 2013 23:06:40 +0000 (15:06 -0800)]
auto merge of #11060 : pcwalton/rust/tydecode-pod, r=pcwalton

r? @brson

10 years agoFix two regressions introduced by #11072.
Chris Morgan [Thu, 19 Dec 2013 22:33:47 +0000 (09:33 +1100)]
Fix two regressions introduced by #11072.

There, concrete evidence that I shouldn't try doing such things at 1:30am.

10 years agolibrustc: Add missing case for the `Pod` bound in `tydecode`.
Patrick Walton [Wed, 18 Dec 2013 23:03:32 +0000 (15:03 -0800)]
librustc: Add missing case for the `Pod` bound in `tydecode`.

10 years agoauto merge of #11072 : chris-morgan/rust/ctags-tweaks, r=cmr
bors [Thu, 19 Dec 2013 20:01:59 +0000 (12:01 -0800)]
auto merge of #11072 : chris-morgan/rust/ctags-tweaks, r=cmr

Anchoring the keyword as the first non-whitespace on a line may mean
that the occasional genuine-but-unconventionally-formatted tag is
missed, but it avoids a large number of false positives.

I changed the type descriptive texts about a bit too. That part's purely
cosmetic.

I also changed the ignored file list to use a filename matching the make
rule, `TAGS.vi` instead of `TAGS.vim`.

10 years agoauto merge of #11070 : ezyang/rust/better-errors, r=alexcrichton
bors [Thu, 19 Dec 2013 17:51:40 +0000 (09:51 -0800)]
auto merge of #11070 : ezyang/rust/better-errors, r=alexcrichton

On the advice of @huonw, I've just replaced item_span outright.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
10 years agoAccept trailing commas in struct patterns
Alex Crichton [Thu, 19 Dec 2013 17:21:05 +0000 (09:21 -0800)]
Accept trailing commas in struct patterns

We decided in the 12/10/13 weekly meeting that trailing commas should be
accepted pretty much anywhere. They are currently not allowed in struct
patterns, and this commit adds support for that.

Closes #10392

10 years agomklldeps.py: Ignore extra whitespaces of argument
klutzy [Thu, 19 Dec 2013 15:50:36 +0000 (00:50 +0900)]
mklldeps.py: Ignore extra whitespaces of argument

10 years agorustc: Handle `#[link(name = "")]` error
klutzy [Thu, 19 Dec 2013 15:29:39 +0000 (00:29 +0900)]
rustc: Handle `#[link(name = "")]` error

10 years agoauto merge of #11041 : cmr/rust/pkgid_changes, r=cmr,metajack
bors [Thu, 19 Dec 2013 15:51:36 +0000 (07:51 -0800)]
auto merge of #11041 : cmr/rust/pkgid_changes, r=cmr,metajack

10 years agoAdd some things to inspect crate-id's
Corey Richardson [Thu, 19 Dec 2013 15:18:37 +0000 (10:18 -0500)]
Add some things to inspect crate-id's

10 years agoRename pkgid to crate_id
Corey Richardson [Tue, 17 Dec 2013 21:40:33 +0000 (16:40 -0500)]
Rename pkgid to crate_id

Closes #11035

10 years agoRemove many false positives from the ctags results
Chris Morgan [Thu, 19 Dec 2013 14:31:38 +0000 (01:31 +1100)]
Remove many false positives from the ctags results

Anchoring the keyword as the first non-whitespace on a line may mean
that the occasional genuine-but-unconventionally-formatted tag is
missed, but it avoids a large number of false positives.

I changed the type descriptive texts about a bit too. That part's purely
cosmetic.

I also changed the ignored file list to use a filename matching the make
rule, `TAGS.vi` instead of `TAGS.vim`.

10 years agoextra: silence warnings during testing.
Huon Wilson [Thu, 19 Dec 2013 14:17:04 +0000 (01:17 +1100)]
extra: silence warnings during testing.

10 years agostd: silence warnings when compiling test.
Huon Wilson [Thu, 19 Dec 2013 14:12:56 +0000 (01:12 +1100)]
std: silence warnings when compiling test.

10 years agoauto merge of #11061 : huonw/rust/opt-unsafe-vec, r=alexcrichton
bors [Thu, 19 Dec 2013 12:26:34 +0000 (04:26 -0800)]
auto merge of #11061 : huonw/rust/opt-unsafe-vec, r=alexcrichton

Before:

```
test vec::bench::random_inserts                     ... bench:     15025 ns/iter (+/- 409)
test vec::bench::random_removes                     ... bench:     16063 ns/iter (+/- 276)
```

After:

```
test vec::bench::random_inserts                     ... bench:      5257 ns/iter (+/- 321)
test vec::bench::random_removes                     ... bench:      4980 ns/iter (+/- 94)
```

10 years agostd::vec: use some unsafe code to optimise `remove`.
Huon Wilson [Thu, 19 Dec 2013 02:56:53 +0000 (13:56 +1100)]
std::vec: use some unsafe code to optimise `remove`.

Also, add `.remove_opt` and replace `.unshift` with `.remove(0)`. The
code size reduction seem to compensate for not having the optimised
special cases.

This makes the included benchmark more than 3 times faster.

10 years agoGeneralize item_span into node_span, which works on more types.
Edward Z. Yang [Thu, 19 Dec 2013 06:41:59 +0000 (14:41 +0800)]
Generalize item_span into node_span, which works on more types.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
10 years agoauto merge of #11065 : huonw/rust/slice-chars-example, r=cmr
bors [Thu, 19 Dec 2013 10:36:34 +0000 (02:36 -0800)]
auto merge of #11065 : huonw/rust/slice-chars-example, r=cmr

10 years agoauto merge of #11038 : alexcrichton/rust/fix-osx-leak, r=cmr
bors [Thu, 19 Dec 2013 08:16:35 +0000 (00:16 -0800)]
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

10 years agoUpgrade libuv to fix a leak on OSX
Alex Crichton [Tue, 17 Dec 2013 21:12:36 +0000 (13:12 -0800)]
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

10 years agoauto merge of #11050 : alexcrichton/rust/snapshots, r=brson
bors [Thu, 19 Dec 2013 06:41:36 +0000 (22:41 -0800)]
auto merge of #11050 : alexcrichton/rust/snapshots, r=brson

Time for a visit from the snapshot fairy!

10 years agostd::str: fix .slice_chars example. Fixes #11014.
Huon Wilson [Thu, 19 Dec 2013 06:36:44 +0000 (17:36 +1100)]
std::str: fix .slice_chars example. Fixes #11014.

10 years agoauto merge of #10977 : brson/rust/androidtest, r=brson
bors [Thu, 19 Dec 2013 04:06:33 +0000 (20:06 -0800)]
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.

10 years agostd::vec: replace .insert with a small amount of unsafe code.
Huon Wilson [Thu, 19 Dec 2013 02:23:37 +0000 (13:23 +1100)]
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.

10 years agoauto merge of #10927 : g3xzh/rust/sum_bugfix, r=huonw
bors [Thu, 19 Dec 2013 02:41:35 +0000 (18:41 -0800)]
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,

10 years agoMake Android tests fail if no device is available
Brian Anderson [Sun, 15 Dec 2013 06:42:01 +0000 (22:42 -0800)]
Make Android tests fail if no device is available

10 years agoauto merge of #11029 : huonw/rust/rm-vec-as-buf, r=cmr
bors [Thu, 19 Dec 2013 01:11:42 +0000 (17:11 -0800)]
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`

10 years agoFix `sum()` accuracy
g3xzh [Wed, 11 Dec 2013 23:57:13 +0000 (01:57 +0200)]
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

10 years agostd::str: remove .as_mut_buf & rewrite/simplify `.push_char`.
Huon Wilson [Tue, 17 Dec 2013 15:46:26 +0000 (02:46 +1100)]
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`.

10 years agostd::str: replace .as_imm_buf with .as_ptr.
Huon Wilson [Tue, 17 Dec 2013 15:37:30 +0000 (02:37 +1100)]
std::str: replace .as_imm_buf with .as_ptr.

10 years agostd::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len.
Huon Wilson [Tue, 17 Dec 2013 15:13:20 +0000 (02:13 +1100)]
std::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len.

10 years agoauto merge of #11032 : cmr/rust/rustdoc_test, r=alexcrichton
bors [Wed, 18 Dec 2013 23:16:39 +0000 (15:16 -0800)]
auto merge of #11032 : cmr/rust/rustdoc_test, r=alexcrichton

This is just a smoke test which verifies that the expected files are
generated.

10 years agostd::vec: remove .as_imm_buf, replaced by .as_ptr & .len.
Huon Wilson [Tue, 17 Dec 2013 14:49:31 +0000 (01:49 +1100)]
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.

10 years agorustdoc: thread through the context for rendering
Corey Richardson [Wed, 18 Dec 2013 17:26:19 +0000 (12:26 -0500)]
rustdoc: thread through the context for rendering

This partially reverts 8b5a317.

10 years agoAdd a rustdoc test
Corey Richardson [Tue, 17 Dec 2013 17:05:36 +0000 (12:05 -0500)]
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.

10 years agoauto merge of #11013 : klutzy/rust/win-no-pthread, r=alexcrichton
bors [Wed, 18 Dec 2013 20:16:35 +0000 (12:16 -0800)]
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.

10 years agoauto merge of #11012 : alexcrichton/rust/needstest, r=alexcrichton
bors [Wed, 18 Dec 2013 18:36:51 +0000 (10:36 -0800)]
auto merge of #11012 : alexcrichton/rust/needstest, r=alexcrichton

Closes #5806
Closes #8259
Closes #8578
Closes #8851
Closes #10412

10 years agoRegister new snapshots
Alex Crichton [Wed, 18 Dec 2013 17:29:50 +0000 (09:29 -0800)]
Register new snapshots

Time for a visit from the snapshot fairy!

10 years agoAdding tests for closed issues
Alex Crichton [Tue, 17 Dec 2013 01:04:02 +0000 (17:04 -0800)]
Adding tests for closed issues

Closes #5806
Closes #5950
Closes #7178
Closes #8259
Closes #8578
Closes #8851
Closes #9129
Closes #10412

10 years agoauto merge of #11033 : michaelwoerister/rust/byvalself, r=pcwalton
bors [Wed, 18 Dec 2013 16:36:36 +0000 (08:36 -0800)]
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

10 years agoauto merge of #11024 : huonw/rust/return-from-closures, r=alexcrichton
bors [Wed, 18 Dec 2013 14:26:33 +0000 (06:26 -0800)]
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.

10 years agoauto merge of #10915 : alexcrichton/rust/fixes, r=ILyoan
bors [Wed, 18 Dec 2013 13:01:47 +0000 (05:01 -0800)]
auto merge of #10915 : alexcrichton/rust/fixes, r=ILyoan

Just a little cleanup.

10 years agorustc: Allow `return` to return from a closure.
Huon Wilson [Tue, 17 Dec 2013 13:06:20 +0000 (00:06 +1100)]
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.

10 years agoauto merge of #11025 : ezyang/rust/reword-second-borrow, r=cmr
bors [Wed, 18 Dec 2013 11:36:33 +0000 (03:36 -0800)]
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>
10 years agoauto merge of #11018 : sfackler/rust/variant-strip, r=alexcrichton
bors [Wed, 18 Dec 2013 07:51:34 +0000 (23:51 -0800)]
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.

10 years agoauto merge of #11019 : alexcrichton/rust/issue-10545, r=pcwalton
bors [Wed, 18 Dec 2013 05:31:47 +0000 (21:31 -0800)]
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

10 years agomklldeps.py: Write to file instead of print
klutzy [Tue, 17 Dec 2013 05:35:22 +0000 (14:35 +0900)]
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.

10 years agollvm: Disable pthread on mingw
klutzy [Mon, 16 Dec 2013 18:39:44 +0000 (03:39 +0900)]
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.

10 years agoauto merge of #11009 : ktt3ja/rust/issue-11006, r=alexcrichton
bors [Tue, 17 Dec 2013 23:51:35 +0000 (15:51 -0800)]
auto merge of #11009 : ktt3ja/rust/issue-11006, r=alexcrichton

Fix #11006.

10 years agoauto merge of #10967 : chris-morgan/rust/clean-and-tidy-some-traits, r=alexcrichton
bors [Tue, 17 Dec 2013 20:56:39 +0000 (12:56 -0800)]
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`.

10 years agoauto merge of #10979 : alexcrichton/rust/less-bc, r=cmr
bors [Tue, 17 Dec 2013 19:36:42 +0000 (11:36 -0800)]
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

10 years agoauto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichton
bors [Tue, 17 Dec 2013 18:21:44 +0000 (10:21 -0800)]
auto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichton

Translate ENOENT to IoErrorKind::FileNotFound.

10 years agoDon't allow impls to force public types
Alex Crichton [Tue, 17 Dec 2013 07:32:37 +0000 (23:32 -0800)]
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

10 years agodebuginfo: Updated test cases to also test by-value self arguments.
Michael Woerister [Tue, 17 Dec 2013 15:54:22 +0000 (16:54 +0100)]
debuginfo: Updated test cases to also test by-value self arguments.

10 years agodebuginfo: Properly support by-value self arguments
Michael Woerister [Tue, 17 Dec 2013 15:52:16 +0000 (16:52 +0100)]
debuginfo: Properly support by-value self arguments

10 years agoauto merge of #11030 : cmr/rust/rustdoc_on_fire, r=metajack
bors [Tue, 17 Dec 2013 17:01:58 +0000 (09:01 -0800)]
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.

10 years agoFix rustdoc HTML rendering
Corey Richardson [Tue, 17 Dec 2013 16:19:14 +0000 (11:19 -0500)]
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.

10 years agoauto merge of #10972 : metajack/rust/pkgid-with-name, r=alexcrichton
bors [Tue, 17 Dec 2013 15:41:40 +0000 (07:41 -0800)]
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.

10 years agoUpdate docs to new syntax.
Jack Moffitt [Sun, 15 Dec 2013 02:58:20 +0000 (19:58 -0700)]
Update docs to new syntax.

10 years agoChange pkgid parser to allow overriding the inferred crate name.
Jack Moffitt [Sun, 15 Dec 2013 02:58:07 +0000 (19:58 -0700)]
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`.

10 years agoauto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton
bors [Tue, 17 Dec 2013 14:26:40 +0000 (06:26 -0800)]
auto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton

There is no `~mut T` and `[mut T]` any more.

10 years agoauto merge of #10998 : thestinger/rust/iter, r=alexcrichton
bors [Tue, 17 Dec 2013 13:11:41 +0000 (05:11 -0800)]
auto merge of #10998 : thestinger/rust/iter, r=alexcrichton

10 years agos/Second borrow/Previous borrow/ in error messages.
Edward Z. Yang [Tue, 17 Dec 2013 12:55:33 +0000 (20:55 +0800)]
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>
10 years agoHandle ENOENT
Cadence Marseille [Sun, 8 Dec 2013 22:12:41 +0000 (17:12 -0500)]
Handle ENOENT

Translate ENOENT to IoErrorKind::FileNotFound.

10 years agoauto merge of #10996 : huonw/rust/more-vec-raw, r=cmr
bors [Tue, 17 Dec 2013 11:51:40 +0000 (03:51 -0800)]
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[]`.

10 years agoauto merge of #10990 : ktt3ja/rust/method-stability, r=huonw
bors [Tue, 17 Dec 2013 10:31:55 +0000 (02:31 -0800)]
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.

10 years agoauto merge of #10830 : alexcrichton/rust/spsc-queue, r=brson
bors [Tue, 17 Dec 2013 09:16:43 +0000 (01:16 -0800)]
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.

10 years agoauto merge of #10924 : pcwalton/rust/pod, r=pcwalton
bors [Tue, 17 Dec 2013 06:56:45 +0000 (22:56 -0800)]
auto merge of #10924 : pcwalton/rust/pod, r=pcwalton

This will be used for the new `Cell`.

r? @nikomatsakis

10 years agoTest fallout from std::comm rewrite
Alex Crichton [Mon, 16 Dec 2013 02:17:43 +0000 (18:17 -0800)]
Test fallout from std::comm rewrite

10 years agodoc: Update the documentation to describe the `Pod` trait.
Patrick Walton [Sun, 15 Dec 2013 23:19:18 +0000 (15:19 -0800)]
doc: Update the documentation to describe the `Pod` trait.

10 years agotest: Add a test that POD types can be implicitly copied.
Patrick Walton [Thu, 12 Dec 2013 01:39:43 +0000 (17:39 -0800)]
test: Add a test that POD types can be implicitly copied.

10 years agolibstd: Implement the new `Cell`.
Patrick Walton [Wed, 11 Dec 2013 22:54:27 +0000 (14:54 -0800)]
libstd: Implement the new `Cell`.

10 years agolibrustc: Implement a `Pod` kind for types that can be `memcpy`'d.
Patrick Walton [Wed, 11 Dec 2013 20:40:51 +0000 (12:40 -0800)]
librustc: Implement a `Pod` kind for types that can be `memcpy`'d.

This will be used for the new `Cell`.

10 years agoFix rustdoc output of enums with private variants
Steven Fackler [Tue, 17 Dec 2013 05:30:02 +0000 (21:30 -0800)]
Fix rustdoc output of enums with private variants

Previously, if every variant was private, it would display as a
variantless enum instead of having the "some variants stripped" comment.