Commit Graph

24563 Commits

Author SHA1 Message Date
bors
256f6976ad auto merge of #11095 : brson/rust/issue-11094, r=alexcrichton 2013-12-21 19:46:35 -08:00
bors
ba801d8116 auto merge of #11100 : klutzy/rust/win-no-pthread-2, r=alexcrichton 2013-12-21 00:56:30 -08:00
klutzy
dfe58a9851 rustuv: Stop link to pthread on Windows 2013-12-21 15:44:18 +09:00
bors
20f13b228f 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
2013-12-20 20:01:41 -08:00
bors
35fc0c8fe4 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.
2013-12-20 18:46:31 -08:00
Brian Anderson
675aac3001 mk: Work around problem with run-make tests on multiple targets. #11094 2013-12-20 18:06:12 -08:00
Palmer Cox
765bc9064f Implement size_hint() for ByRef iterator 2013-12-20 20:40:16 -05:00
Palmer Cox
2c539d4eec 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.
2013-12-20 20:40:16 -05:00
Palmer Cox
efd619467d 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.
2013-12-20 20:40:16 -05: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
bors
9d1de0b699 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.
2013-12-20 15:21:33 -08:00
Jan Niklas Hasse
5cf2f54bb1 Support ANSI colors in msys terminals. See #2807 2013-12-20 22:32:27 +01:00
bors
d5d5c5064b auto merge of #10986 : adridu59/rust/patch-new, r=alexcrichton
Thanks to @huonw for some mentoring. 🍰
2013-12-20 12:41:33 -08:00
Adrien Tétar
bf5f2f2631 doc: forward-port the conditions tutorial + fixup libstd example 2013-12-20 18:40:26 +01:00
bors
810c4de6a4 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
2013-12-20 09:11:33 -08:00
Alex Crichton
87add53327 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.
2013-12-20 09:10:11 -08:00
bors
5399c82d56 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
2013-12-20 04:36:32 -08:00
bors
6023350082 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.
2013-12-20 02:06:34 -08:00
Alex Crichton
64faafba19 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.
2013-12-19 23:34:32 -08:00
bors
bb02d147fe auto merge of #11073 : klutzy/rust/issue-10978, r=alexcrichton
This patchset fixes small glitches which caused #10978.
2013-12-19 20:06:36 -08:00
bors
415e55a02c auto merge of #11071 : huonw/rust/quiet-test, r=cmr 2013-12-19 18:51:39 -08: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
Alex Crichton
f89b61ba3a Get comm_adapters building again
I accidentally removed this module from compilation awhile back, this adds it
back in.

Closes #11076
2013-12-19 15:42:44 -08:00
bors
d069d58e31 auto merge of #11060 : pcwalton/rust/tydecode-pod, r=pcwalton
r? @brson
2013-12-19 15:06:40 -08:00
Chris Morgan
22055802cf Fix two regressions introduced by #11072.
There, concrete evidence that I shouldn't try doing such things at 1:30am.
2013-12-20 09:33:47 +11:00
Patrick Walton
b982f08a66 librustc: Add missing case for the Pod bound in tydecode. 2013-12-19 14:13:19 -08:00
bors
3906823765 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`.
2013-12-19 12:01:59 -08:00
bors
bc17e4fda7 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>
2013-12-19 09:51:40 -08:00
Alex Crichton
bfb760c697 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
2013-12-19 09:29:41 -08:00
klutzy
da818e9a26 mklldeps.py: Ignore extra whitespaces of argument 2013-12-20 01:53:41 +09:00
klutzy
2afa97a346 rustc: Handle #[link(name = "")] error 2013-12-20 01:53:41 +09:00
bors
d760f994de auto merge of #11041 : cmr/rust/pkgid_changes, r=cmr,metajack 2013-12-19 07:51:36 -08:00
Corey Richardson
b25a0524dc Add some things to inspect crate-id's 2013-12-19 10:18:37 -05:00
Corey Richardson
dee1107571 Rename pkgid to crate_id
Closes #11035
2013-12-19 10:10:23 -05:00
Chris Morgan
a1ca7458f1 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`.
2013-12-20 01:59:01 +11:00
Huon Wilson
f13d57f8d3 extra: silence warnings during testing. 2013-12-20 01:26:03 +11:00
Huon Wilson
c00104f36a std: silence warnings when compiling test. 2013-12-20 01:26:03 +11:00
bors
e86cdaf23d 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)
```
2013-12-19 04:26:34 -08:00
Huon Wilson
acd2be46f1 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.
2013-12-19 23:20:20 +11:00
Edward Z. Yang
6ad1c8e044 Generalize item_span into node_span, which works on more types.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-19 19:58:08 +08:00
bors
b3cee62034 auto merge of #11065 : huonw/rust/slice-chars-example, r=cmr 2013-12-19 02:36:34 -08:00
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