Commit Graph

26555 Commits

Author SHA1 Message Date
Liigo Zhuang
53b9d1a324 move extra::test to libtest 2014-02-20 16:03:58 +08:00
bors
0cc8ba0c20 auto merge of #12244 : pcwalton/rust/deuniquevectorpatterns, r=pcwalton
Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.

r? @brson
2014-02-19 21:56:51 -08:00
bors
801f8f67f8 auto merge of #12394 : huonw/rust/transmute--, r=pnkfelix
These can all be done by implicit or explicit &T -> *T casts, which are
more restricted and so are safer.
2014-02-19 20:41:51 -08:00
Patrick Walton
33923f47e3 librustc: Remove unique vector patterns from the language.
Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.
2014-02-19 16:35:31 -08:00
bors
879e8aa7be auto merge of #12387 : cmr/rust/ast-json, r=alexcrichton
See the commits
2014-02-19 16:21:48 -08:00
bors
ea0058281c auto merge of #12389 : zr40/rust/fix-test-metric-typo, r=alexcrichton 2014-02-19 15:01:50 -08:00
bors
6ae5de0223 auto merge of #12231 : wycats/rust/url_path_parse, r=alexcrichton
It is sometimes useful to parse just the path portion of a URL (path,
query string and fragment) rather than the entire URL.

In theory I could have made Url embed a Path, but that would be a
breaking change and I assume that Servo uses this API. I would be
happy to update the PR to embed Path in Url if that's what people
wanted.
2014-02-19 12:51:48 -08:00
bors
1228fb0c99 auto merge of #11904 : nick29581/rust/0filemap, r=alexcrichton 2014-02-19 11:36:48 -08:00
Corey Richardson
34ffe3cc1c rustc: support dumping the AST as JSON
This is mostly useful for working on rustc, when one is unfamiliar with the
AST a particular construct will produce. It's a -Z flag as it's very much for
debugging.

Closes #10485
2014-02-19 13:32:26 -05:00
bors
209b47f248 auto merge of #12379 : alexcrichton/rust/fix-ar-thing, r=brson
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-19 10:21:50 -08:00
bors
af4b5b4aac auto merge of #12375 : FlaPer87/rust/issue-7660, r=cmr 2014-02-19 09:01:51 -08:00
bors
98b07755dd auto merge of #12374 : dylanbraithwaite/rust/size_of_unit_clarification, r=cmr
Changed the docs for std::mem to clarify the fact that the size functions return sizes in bytes.
2014-02-19 07:16:48 -08:00
Huon Wilson
dcee327c35 rustc: remove some unnecessary transmutes.
These can all be done by implicit or explicit &T -> *T casts, which are
more restricted and so are safer.
2014-02-20 01:31:39 +11:00
bors
ace204a745 auto merge of #12349 : edwardw/rust/debug-expansion, r=huonw
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 06:01:45 -08: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