Commit Graph

24706 Commits

Author SHA1 Message Date
Vadim Chugunov
e3b37154b0 Stop using C++ exceptions for stack unwinding. 2013-12-24 12:13:42 -08:00
bors
b8c87fd9fe auto merge of #11130 : olsonjeffery/rust/master, r=alexcrichton
So that `Uuid` can be used as the key in a `HashMap` or in a `HashSet`, etc

The only question I have about this is: Is endianness an issue, here? If so, what's the correct way to proceed?
2013-12-24 01:56:30 -08:00
bors
e09a8e8923 auto merge of #11091 : brson/rust/cratelinkattr, r=brson
This is set to *forbid* and prints a note explaining how to fix the problem.
2013-12-24 00:41:33 -08:00
Jeff Olson
41cbbb656a extra: impl IterBytes for uuid::Uuid 2013-12-23 23:44:58 -08:00
Brian Anderson
26f1b4db11 rustc: Add a lint for the obsolete crate-level link attribute 2013-12-23 21:04:01 -08:00
bors
619c4fce89 auto merge of #11022 : spaolacci/rust/0read, r=alexcrichton
Could prevent callers from catching the situation and lead to e.g early
iterator terminations (cf. `Reader::read_byte`) since `None` is only to
be returned only on EOF.
2013-12-23 11:26:34 -08:00
bors
d9c06586f2 auto merge of #11120 : alexcrichton/rust/rustdoc-test, r=brson
This commit adds a `--test` flag to rustdoc to expose the ability to test code examples in doc strings. This work by using sundown's `lang` attribute to figure out how a code block should be tested. The format for this is:

```
1. ```rust
2. ```rust,ignore
3. ```rust,notest
4. ```rust,should_fail
```

Where `rust` means that rustdoc will attempt to test is, `ignore` means that it will not execute the test but it will compile it, `notest` means that rustdoc completely ignores it, and `should_fail` means that the test should fail. This commit also leverages `extra::test` for the testing harness in order to allow parallelization and whatnot.

I have fixed all existing code examples in libstd and libextra, but I have not made a pass through the crates in order to change code blocks to testable code blocks.

It may also be a questionable decision to require opting-in to a testable code block.

Finally, I kept our sugar in the doc suite to omit lines starting with `#` in documentation but still process them during tests.

Closes #2925
2013-12-23 09:16:37 -08:00
Alex Crichton
f9b231cd08 Fixing more doc tests 2013-12-23 09:10:37 -08:00
Alex Crichton
316345610a doc: Expand rustdoc's documentation for testing 2013-12-23 09:10:37 -08:00
Alex Crichton
fe8b360c9d mk: Run doc tests as part of 'make check'
Don't run doc tests during make check-fast because it involves spawning lots of
processes.
2013-12-23 09:10:37 -08:00
Alex Crichton
d882b1d4f9 extra: Fix all code examples 2013-12-23 09:10:36 -08:00
Alex Crichton
9f1739a8e1 std: Fix all code examples 2013-12-23 09:10:36 -08:00
Alex Crichton
6c9c045064 rustdoc: Add the ability to test code in comments
This adds support for the `--test` flag to rustdoc which will parse a crate,
extract all code examples in doc comments, and then run each test in the
extra::test driver.
2013-12-23 09:10:36 -08:00
Sébastien Paolacci
ee887d7078 Add tests for 0-byte read propagation.
The two `Some(0)' used to be `None' before the patch, a zero-byte long
read exhausting a reader (and thereafter) still produce a `None'.
2013-12-23 09:35:52 +01:00
bors
f71c0dc2cd auto merge of #11069 : alexcrichton/rust/issue-11067, r=brson
Turns out libuv's build system doesn't like us telling them that the build
directory is a relative location, as it always spits out a warning about a
circular dependency being dropped. By using an absolute path, turns out the
warnings isn't spit out, who knew?

Closes #11067
2013-12-22 22:36:30 -08:00
Alex Crichton
9d59e358d9 uv: Suppress a warning by using an absolute path
Turns out libuv's build system doesn't like us telling them that the build
directory is a relative location, as it always spits out a warning about a
circular dependency being dropped. By using an absolute path, turns out the
warnings isn't spit out, who knew?

Closes #11067
2013-12-22 22:30:51 -08:00
bors
57724012ff auto merge of #11111 : alexcrichton/rust/issue-11039, r=brson
None of these primitives should be Freeze because sharing them in an Arc is a
very bad idea.

Closes #11039
2013-12-22 18:21:34 -08:00
bors
1b4bbc89b3 auto merge of #11109 : sfackler/rust/arc, r=alexcrichton
Closes #11097
2013-12-22 16:56:31 -08:00
bors
9e00272441 auto merge of #11046 : zargony/rust/dep-info, r=alexcrichton
Using --dep-info writes Makefile-compatible dependency info to a file that is by default named based on the crate source filename. This adds an optional string argument to the --dep-info option which allows to write dependency info to an arbitrary filename.

cc #10698
2013-12-22 15:06:32 -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
Andreas Neuhaus
66e3fbebd9 Allow optional filename argument for --dep-info 2013-12-22 21:38:55 +01:00
Andreas Neuhaus
5d0fea1441 Use --crate-file-name to find out the library filename in dep-info test 2013-12-22 21:37:33 +01:00
bors
0478142b5f auto merge of #11096 : brson/rust/pp, r=alexcrichton 2013-12-22 12:36:35 -08:00
bors
2e4cd83a0a auto merge of #11082 : brson/rust/noat, r=alexcrichton 2013-12-22 11:21:36 -08:00
bors
9b1e7db71c auto merge of #11114 : klutzy/rust/a, r=cmr 2013-12-22 04:16:37 -08:00
klutzy
dd44a25fd0 mk: Clean .lib files 2013-12-22 21:05:50 +09: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
645fff4bc8 fix check-fast tests. 2013-12-22 19:32:17 +11: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
bors
cd13f4d599 auto merge of #10997 : cadencemarseille/rust/issue-10755-ICE-for-missing-linker, r=alexcrichton
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-21 22:16:37 -08:00
Alex Crichton
67c0222252 Guarantee comm primitives are not Freeze
None of these primitives should be Freeze because sharing them in an Arc is a
very bad idea.

Closes #11039
2013-12-21 21:54:05 -08:00
bors
9a8f79133b 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@fd5308383c,
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.
2013-12-21 21:01:51 -08:00
Alex Crichton
61222b00e2 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@fd5308383c,
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.
2013-12-21 20:17:23 -08: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
bors
256f6976ad auto merge of #11095 : brson/rust/issue-11094, r=alexcrichton 2013-12-21 19:46:35 -08:00
Brian Anderson
6f16df4aa3 std: Remove some @-boxes 2013-12-21 17:50:54 -08:00
Jan Niklas Hasse
5746e0cd2a Remove unnecessary semicolon 2013-12-21 17:31:24 +01: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
a5d26a2e37 mk: Remove obsolete source reformatting rules 2013-12-20 18:31:00 -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
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