Commit Graph

26794 Commits

Author SHA1 Message Date
Eduard Bopp
cb3a419d97 libnum: Make RandBigInt trait public
Closes #12383.
2014-02-19 14:01:50 +01:00
Edward Wang
111e092481 Change the format_args! macro expansion for temporaries
Currently, the format_args! macro and its downstream macros in turn
expand to series of let statements, one for each of its arguments, and
then the invocation of the macro function. If one or more of the
arguments are RefCell's, the enclosing statement for the temporary of
the let is the let itself, which leads to scope problem. This patch
changes let's to a match expression.

Closes #12239.
2014-02-19 20:54:44 +08:00
bors
99f838012b auto merge of #12370 : rcxdude/rust/macro_fix, r=alexcrichton
Closes #11692. Instead of returning the original expression, a dummy expression
(with identical span) is returned. This prevents infinite loops of failed
expansions as well as odd double error messages in certain situations.

This is a slightly better fix than #12197, because it does not produce a double error and also fixes a few other cases where an infinite loop could happen.

This does not fix the other issue in #11692 (non-builtin macros not being recognised when expanded inside macros), which I think should be moved into a separate issue.
2014-02-19 04:41:45 -08:00
bors
d2f265d195 auto merge of #12367 : darnuria/rust/tutorial_removing_do_syntax, r=cmr
The 'do' keyword was deprecated in 0.10 #11868 , and is keep as
reserved keyword  #12157 .

So the tutorial part about it doesn't make sense.
The spawning explanation was move into '15.2 Closure compatibility'.
2014-02-19 03:26:48 -08:00
bors
c4afcf44d2 auto merge of #12339 : alexcrichton/rust/rustdoc-fixes, r=sfackler
Commits have the details
2014-02-19 02:11:48 -08:00
Alex Crichton
429ef870f6 rustdoc: Handle links to reexported items
When building up our path cache, we don't plaster over a path which was
previously inserted if we're inserting a non-public-item thing.

Closes #11678
2014-02-19 01:30:52 -08:00
Alex Crichton
cac9107f38 rustdoc: Clickable links on methods themselves
Useful for getting the link to a method or function.

Closes #10332
2014-02-19 01:10:32 -08:00
Alex Crichton
68d576fd34 rustdoc: Fix json output and input
Turns out a hash map with integer keys isn't serializable to json.

Closes #10115
2014-02-19 01:10:31 -08:00
Alex Crichton
6db37bb147 rustdoc: Highlight methods jumped to
This helps figure out where you actually jumped to, especially if the thing you
jumped to is at the very bottom of the page.

Closes #9905
2014-02-19 01:10:31 -08:00
Alex Crichton
867988c1dc rustdoc: Show macros in documentation
Any macro tagged with #[macro_export] will be showed in the documentation for
that module. This also documents all the existing macros inside of std::macros.

Closes #3163
cc #5605
Closes #9954
2014-02-19 01:10:31 -08:00
Alex Crichton
f0cb0ebc66 rustdoc: Fixup links to enum variants
Pages aren't emitted for enum variants, so whenever we're linking to an enum
variant instead link to the parent enum instead.

Closes #12289
2014-02-19 01:10:31 -08:00
bors
9f68f793d4 auto merge of #12364 : Armavica/rust/mk-tips, r=alexcrichton
The command `make tips` did not work properly because of a flaw in the regexp parsing Makefile.in for documentation (`SHOW_DOCS`). I fixed it and also added a note about `make clean` in the build documentation (`make help`).
2014-02-19 00:56:51 -08:00
Matthijs van der Vleuten
e6740bb983 Fix typo in test metric ratchet stdout output 2014-02-19 09:40:06 +01:00
bors
74f3e0474b auto merge of #12361 : sfackler/rust/rustdoc-test-extern, r=alexcrichton 2014-02-18 22:16:47 -08:00
Steven Fackler
0658913616 rustdoc: Only inject extern crates if not present 2014-02-18 20:42:29 -08:00
bors
cae5999a54 auto merge of #12317 : huonw/rust/utf16, r=alexcrichton
Iterators! Use them (in `is_utf16`), create them (in `utf16_items`).

Handle errors gracefully (`from_utf16_lossy`) and `from_utf16` returning `Option<~str>` instead of failing.

Add a pile of tests.
2014-02-18 19:26:50 -08:00
Huon Wilson
c9b4538bab str: add a function for truncating a vector of u16 at NUL.
Many of the functions interacting with Windows APIs allocate a vector of
0's and do not retrieve a length directly from the API call, and so need
to be sure to remove the unmodified junk at the end of the vector.
2014-02-19 14:09:16 +11:00
bors
a25f447835 auto merge of #12245 : nick29581/rust/priv2, r=alexcrichton
closes #4110
2014-02-18 18:11:48 -08:00
Nick Cameron
df1686dbf1 Make priavcy checking aware that a use directive can point to two defintions (namespaces) with different privacy. Closes #4110 2014-02-19 14:47:10 +13:00
Nick Cameron
418eea1154 Fix bug with zero-length filemaps and rename bytepos_to_local_charpos to bytepos_to_charpos. 2014-02-19 14:24:07 +13:00
Alex Crichton
2eacc729e2 Fix staticlib outputs linking to blank archives
When creating a staticlib, it unzips all static archives it finds and then
inserts the files manually into the output file. This process is done through
`ar`, and `ar` doesn't like if you specify you want to add files and you don't
give it any files.

This case arose whenever you linked to an archive that didn't have any contents
or all of the contents were filtered out. This just involved ignoring the case
where the number of inputs we have is 0, because we don't have any files to add
anyway.
2014-02-18 16:07:09 -08:00
bors
ee8f45ef95 auto merge of #12359 : alexcrichton/rust/update-compiler-rt, r=luqmana
Closes #12356
2014-02-18 13:41:49 -08:00
Flavio Percoco
65b3036230 Regression test closes #7660 2014-02-18 21:55:18 +01:00
Dylan Braithwaite
56114633e8 Clarify unit of size in docs for size_of functions.
Changed the docs in mem.rs to clarify the fact the the size functions return sizes in bytes.
2014-02-18 20:39:47 +00:00
bors
aa06bf4f12 auto merge of #12357 : chromatic/rust/gh_11976_fail_bounds_check_str, r=alexcrichton
Fixes #11976.
2014-02-18 12:21:45 -08:00
bors
a886549772 auto merge of #12336 : kballard/rust/mutexarc-no-freeze, r=alexcrichton
With Rc no longer trying to statically prevent cycles (and thus no
longer using the Freeze bound), it seems appropriate to remove that
restriction from MutexArc as well.

Closes #9251.
2014-02-18 10:16:48 -08:00
bors
54bccc5862 auto merge of #12330 : nick29581/rust/glue, r=huonw
closes #3290
2014-02-18 08:56:51 -08:00
Douglas Young
0bdfd0f4c7 Avoid returning original macro if expansion fails.
Closes #11692. Instead of returning the original expression, a dummy expression
(with identical span) is returned. This prevents infinite loops of failed
expansions as well as odd double error messages in certain situations.
2014-02-18 16:17:51 +00:00
bors
517e38997d auto merge of #12354 : alexcrichton/rust/fix-rustuv-segfault, r=cmr
The details can be found in the comments I added to the test, but the gist of it
is that capturing output injects rescheduling a green task on failure, which
wasn't desired for the test in question.

cc #12340
2014-02-18 06:46:55 -08:00
Axel Viala
1ede49f49d Removing '15.3 Do syntax' in tutorial.
The 'do' keyword was deprecated in 0.10 #11868 , and is keep as
reserved keyword #12157 .

So the tutorial part about it doesn't make sense.
The spawning explanation was move into '15.2 Closure compatibility'.

Fixing misspelling.

Thanks for precisions.

Moved from 15.2 to 15.1.

Fixed typo, and apply pnkfelix advices.
2014-02-18 15:39:32 +01:00
bors
8391b71122 auto merge of #12351 : kud1ing/rust/backticks, r=alexcrichton 2014-02-18 05:31:55 -08:00
bors
e4ce8a9689 auto merge of #12314 : huonw/rust/is_utf8_iter, r=kballard
See the commit messages for more details, but this makes `std::str::is_utf8` slightly faster and 100% non-`unsafe` and uses a similar thing to make the first scan of `from_utf8_lossy` 100% safe & faster.
2014-02-18 04:06:48 -08:00
Huon Wilson
a39056e614 std: convert first_non_utf8_byte to use the iterator.
This makes it very slightly faster, especially when the string is valid
UTF-8, and completely removes the use of `unsafe` from the first half.

Before:

    from_utf8_lossy_100_ascii              ... bench:       151 ns/iter (+/- 17)
    from_utf8_lossy_100_invalid            ... bench:       447 ns/iter (+/- 33)
    from_utf8_lossy_100_multibyte          ... bench:       135 ns/iter (+/- 4)
    from_utf8_lossy_invalid                ... bench:       124 ns/iter (+/- 10

After:

    from_utf8_lossy_100_ascii              ... bench:       119 ns/iter (+/- 8)
    from_utf8_lossy_100_invalid            ... bench:       454 ns/iter (+/- 16)
    from_utf8_lossy_100_multibyte          ... bench:       116 ns/iter (+/- 9)
    from_utf8_lossy_invalid                ... bench:       119 ns/iter (+/- 9)
2014-02-18 21:55:53 +11:00
Huon Wilson
a68d10e6ad std::str: safen and optimize is_utf8.
This uses a vector iterator to avoid the necessity for unsafe indexing,
and makes this function slightly faster. Unfortunately #11751 means that
the iterator comes with repeated `null` checks which means the
pure-ASCII case still has room for significant improvement (and the
other cases too, but it's most significant for just ASCII).

Before:

    is_utf8_100_ascii             ... bench:       143 ns/iter (+/- 6)
    is_utf8_100_multibyte         ... bench:       134 ns/iter (+/- 4)

After:

    is_utf8_100_ascii             ... bench:       123 ns/iter (+/- 4)
    is_utf8_100_multibyte         ... bench:       115 ns/iter (+/- 5)
2014-02-18 21:55:53 +11:00
Virgile Andreani
54f710fd2d mk: Talk about make clean in the build help 2014-02-18 11:55:34 +01:00
Virgile Andreani
ece12d8da6 mk: Fix the regexp of SHOW_DOCS
The tag marks were missing, and `make tips` didn't work.
2014-02-18 11:53:23 +01:00
bors
b3ed38f219 auto merge of #12345 : huonw/rust/speeling, r=cmr 2014-02-18 02:51:49 -08:00
bors
1e60084257 auto merge of #12342 : ehsanul/rust/remove-shared-chan-tasks-guide, r=alexcrichton
The code examples are up to date, but the surrounding explanations are not.
2014-02-18 01:36:51 -08:00
bors
b0ce960609 auto merge of #12321 : bjz/rust/remove-real, r=alexcrichton
This is part of the effort to simplify `std::num`, as tracked in issue #10387. It is also a step towards a proper IEEE-754 trait (see #12281).
2014-02-17 22:16:51 -08:00
bors
62d7d0079f auto merge of #12103 : alexcrichton/rust/unix, r=brson
There's a few parts to this PR

* Implement unix pipes in libnative for unix platforms (thanks @Geal!)
* Implement named pipes in libnative for windows (terrible, terrible code)
* Remove `#[cfg(unix)]` from `mod unix` in `std::io::net`. This is a terrible name for what it is, but that's the topic of #12093.

The windows implementation was significantly more complicated than I thought it would be, but it seems to be passing all the tests. now.

Closes #11201
2014-02-17 20:01:52 -08:00
Alex Crichton
2b7e33396f Update compiler-rt
Closes #12356
2014-02-17 19:58:47 -08:00
chromatic
96102b3945 Made fail_bounds_check more careful with strings.
Fixes GH #11976.
2014-02-17 19:35:59 -08:00
Nick Cameron
8334915a6c Test ordering of glue_drop and glue_takew in self-re-assignment. Closes #3290. 2014-02-18 16:17:10 +13:00
bors
03c5342419 auto merge of #12243 : dguenther/rust/extend-tidy, r=alexcrichton
Extends the license and formatting check to `*.js` files in `src/doc` and `*.sh`, `*.pl`, `*.c`, and `*.h` files in `src/etc`. As best as I could tell, these files should be covered under the Rust project license.

cc @brson: Do any other scripts need a license? I'd like to double-check that this PR closes #4534.
2014-02-17 18:46:48 -08:00
bors
93a2ee807a auto merge of #12232 : kballard/rust/taskbuilder-is-a-builder, r=alexcrichton
Delete all the documentation from std::task that references linked
failure.

Tweak TaskBuilder to be more builder-like. `.name()` is now `.named()` and
`.add_wrapper()` is now `.with_wrapper()`. Remove `.watched()` and
`.unwatched()` as they didn't actually do anything.

Closes #6399.
2014-02-17 17:31:52 -08:00
bors
25147b2644 auto merge of #12146 : gentlefolk/rust/issue-2404, r=alexcrichton
Addresses FIXME described in issue #2404
2014-02-17 16:11:52 -08:00
gentlefolk
37bf97a0f9 Updated metadata::creader::resolve_crate_deps to use the correct span. Clarified error message when an external crate's dependency is missing. Closes #2404. 2014-02-17 18:34:46 -05:00
Alex Crichton
fd2ed71dcc Fix a segfault in the rustuv tests
The details can be found in the comments I added to the test, but the gist of it
is that capturing output injects rescheduling a green task on failure, which
wasn't desired for the test in question.

cc #12340
2014-02-17 14:41:33 -08:00
bors
5736deb90e auto merge of #12352 : alexcrichton/rust/fix-master, r=brson
This deadlock was caused when the channel was closed at just the right time, so
the extra `self.cnt.fetch_add` actually should have preserved the DISCONNECTED
state of the channel. by modifying this the channel entered a state such that
the port would never succeed in dropping.

This also moves the increment of self.steals until after the MAX_STEALS block.
The reason for this is that in 'fn recv()' the steals variable is decremented
immediately after the try_recv(), which could in theory set steals to -1 if it
was previously set to 0 in try_recv().

Closes #12340
2014-02-17 14:16:53 -08:00
Alex Crichton
9c05c1c236 Fix a deadlock in channels, again.
This deadlock was caused when the channel was closed at just the right time, so
the extra `self.cnt.fetch_add` actually should have preserved the DISCONNECTED
state of the channel. by modifying this the channel entered a state such that
the port would never succeed in dropping.

This also moves the increment of self.steals until after the MAX_STEALS block.
The reason for this is that in 'fn recv()' the steals variable is decremented
immediately after the try_recv(), which could in theory set steals to -1 if it
was previously set to 0 in try_recv().

Closes #12340
2014-02-17 13:59:25 -08:00