Adds support for working with URL Paths

It is sometimes useful to parse just the path portion of a URL (path,
query string and fragment) rather than the entire URL.
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.
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.
Regression test closes #7660
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.
Fix bug with zero-length filemaps and rename bytepos_to_local_charpos to bytepos_to_charpos.
Fix typo in test metric ratchet stdout output
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.
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.
libnum: Make RandBigInt trait public

Closes #12383.
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.
rustc: remove some unnecessary `transmute`s.

These can all be done by implicit or explicit &T -> *T casts, which are
more restricted and so are safer.
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.
Fix getting/setting huge env vars on windows

On windows, the GetEnvironmentVariable function will return the necessary buffer
size if the buffer provided was too small. This case previously fell through the
checks inside of fill_utf16_buf_and_decode, tripping an assertion in the `slice`
method.

This adds an extra case for when the return value is >= the buffer size, in
which case we assume the return value as the new buffer size and try again.

Closes #12376
auto merge of #12375 : FlaPer87/rust/issue-7660, r=cmr
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.
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
auto merge of #11904 : nick29581/rust/0filemap, r=alexcrichton
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.
auto merge of #12389 : zr40/rust/fix-test-metric-typo, r=alexcrichton