bors [Wed, 19 Feb 2014 20:51:48 +0000 (12:51 -0800)]
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.
Corey Richardson [Wed, 19 Feb 2014 07:27:49 +0000 (02:27 -0500)]
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.
bors [Wed, 19 Feb 2014 18:21:50 +0000 (10:21 -0800)]
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.
bors [Wed, 19 Feb 2014 14:01:45 +0000 (06:01 -0800)]
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.
Edward Wang [Mon, 17 Feb 2014 19:32:12 +0000 (03:32 +0800)]
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.
bors [Wed, 19 Feb 2014 12:41:45 +0000 (04:41 -0800)]
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.
Alex Crichton [Mon, 17 Feb 2014 05:40:26 +0000 (21:40 -0800)]
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.
bors [Wed, 19 Feb 2014 08:56:51 +0000 (00:56 -0800)]
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`).
Huon Wilson [Tue, 18 Feb 2014 11:25:32 +0000 (22:25 +1100)]
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.
Alex Crichton [Wed, 19 Feb 2014 00:05:05 +0000 (16:05 -0800)]
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.
bors [Tue, 18 Feb 2014 18:16:48 +0000 (10:16 -0800)]
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.
Douglas Young [Tue, 18 Feb 2014 16:14:12 +0000 (16:14 +0000)]
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.
bors [Tue, 18 Feb 2014 14:46:55 +0000 (06:46 -0800)]
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.
bors [Tue, 18 Feb 2014 12:06:48 +0000 (04:06 -0800)]
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.
Huon Wilson [Sun, 16 Feb 2014 05:11:47 +0000 (16:11 +1100)]
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).
bors [Tue, 18 Feb 2014 04:01:52 +0000 (20:01 -0800)]
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.
bors [Tue, 18 Feb 2014 02:46:48 +0000 (18:46 -0800)]
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.
bors [Tue, 18 Feb 2014 01:31:52 +0000 (17:31 -0800)]
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.
gentlefolk [Mon, 10 Feb 2014 03:29:21 +0000 (22:29 -0500)]
Updated metadata::creader::resolve_crate_deps to use the correct span. Clarified error message when an external crate's dependency is missing. Closes #2404.
Alex Crichton [Mon, 17 Feb 2014 22:41:33 +0000 (14:41 -0800)]
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.
bors [Mon, 17 Feb 2014 22:16:53 +0000 (14:16 -0800)]
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().
Alex Crichton [Mon, 17 Feb 2014 21:59:25 +0000 (13:59 -0800)]
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().
bors [Mon, 17 Feb 2014 16:06:49 +0000 (08:06 -0800)]
auto merge of #12331 : bjz/rust/count-ones, r=alexcrichton
This is inspired by the [function naming in the Julia standard library](http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.count_ones). It seems like a more self-explanatory name, and is more consistent with the accompanying methods, `leading_zeros` and `trailing_zeros`.
Huon Wilson [Sun, 16 Feb 2014 13:52:58 +0000 (00:52 +1100)]
str: provide lossy UTF-16 support.
This replaces the iterator with one that handles lone surrogates
gracefully and uses that to implement `from_utf16_lossy` which replaces
invalid `u16`s with U+FFFD.
bors [Mon, 17 Feb 2014 11:26:51 +0000 (03:26 -0800)]
auto merge of #12284 : brson/rust/install, r=alexcrichton
Work toward #9876.
This adds `prepare.mk`, which is simply a more heavily-parameterized `install.mk`, then uses `prepare` to implement both `install` and the windows installer (`dist`). Smoke tested on both Linux and Windows.
Kevin Ballard [Mon, 17 Feb 2014 04:23:05 +0000 (20:23 -0800)]
Remove Freeze bounds from sync::MutexArc
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.
Alex Crichton [Fri, 7 Feb 2014 18:37:58 +0000 (10:37 -0800)]
Implement named pipes for windows, touch up unix
* Implementation of pipe_win32 filled out for libnative
* Reorganize pipes to be clone-able
* Fix a few file descriptor leaks on error
* Factor out some common code into shared functions
* Make use of the if_ok!() macro for less indentation
Kevin Ballard [Thu, 13 Feb 2014 06:02:09 +0000 (22:02 -0800)]
Clean up std::task docs, make TaskBuilder a real builder
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.
bors [Sun, 16 Feb 2014 15:11:34 +0000 (07:11 -0800)]
auto merge of #12313 : bjz/rust/tuple, r=huonw
This renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters. It also removes the `CloneableTuple` and `ImmutableTuple` traits.
bors [Sun, 16 Feb 2014 07:36:26 +0000 (23:36 -0800)]
auto merge of #12302 : alexcrichton/rust/issue-12295, r=brson
The previous code erroneously assumed that 'steals > cnt' was always true, but
that was a false assumption. The code was altered to decrement steals to a
minimum of 0 instead of taking all of cnt into account.
I didn't include the exact test from #12295 because it could run for quite
awhile, and instead set the threshold for MAX_STEALS to much lower during
testing. I found that this triggered the old bug quite frequently when running
without this fix.