auto merge of #14119 : thestinger/rust/heap, r=cmr
auto merge of #14096 : nick29581/rust/driver, r=brson

The goal of this refactoring is to make the rustc driver code easier to understand and use. Since this is as close to an API as we have, I think it is important that it is nice. On getting stuck in, I found that there wasn't as much to change as I'd hoped to make the stage... functions easier to use by tools (which is a good thing :-) ).

This patch only moves code around - mostly just moving code to different files, but a few extracted method refactorings too. To summarise the changes: I added driver::config which handles everything about configuring the compiler. driver::session now just defines and builds session objects. I moved driver code from librustc/lib.rs to librustc/driver/mod.rs so all the code is one place. I extracted methods to make emulating the compiler without being the compiler a little easier. Within the driver directory, I moved code around to more logically fit in the modules.
register snapshots
auto merge of #14127 : thestinger/rust/snapshot, r=huonw
auto merge of #13922 : Rufflewind/rust/patch-1, r=pnkfelix

Since rust-top-item-beg-re hasn't been defined yet, using defvar instead of
setq is more appropriate here (and also silences compilation warnings).
auto merge of #13932 : MrAlert/rust/win-compat, r=brson

This addresses #12842 by offering fallback implementations for functions that aren't available.

In this case, as Windows XP simply doesn't support symbolic links at all, the fallbacks simply return an error code indicating that the function hasn't been implemented. This should allow programs written in Rust to run under XP while still offering full support for symbolic links under newer versions of Windows with the same binary, but due to LLVM using stderror_s(), which isn't available in msvcrt.dll in XP, rustc itself will not.

The fallback implementation is as follows:

Calling the function instead calls to a mutable function pointer. This in and of itself would not constitute a performance hit because DLL calls are implemented in a similar manner (see Import Address Table). The function pointer initially points to a thunk which tries to get the address of the associated function and write it back to the function pointer. If it fails to find the function, it instead writes the address to a fallback. As this operation is idempotent, reading and writing the pointer simply needs to be atomic. Subsequent calls to the function should be as fast as any other DLL call, as the pointer will then point directly to either the correct function or a fallback.
librustc: Remove all uses of `~str` from librustc.
Factor out foldable better to reduce code duplication.  There is now a "double
dispatch" pattern that lets you easily write new folders and then apply them to
various structures, reusing the "folding" effort.
librustdoc: Remove all `~str` usage from librustdoc.
auto merge of #14157 : pcwalton/rust/detildestr-rustdoc, r=pcwalton

r? @brson
Fix typos in rustc manpage
Add the patch number to version strings. Closes #13289
rustdoc: Fix hiding implementations of traits

This bug was introduced when rustdoc gained the ability to hyperlink across
crates in pub use statements.

Closes #14125
add shebang to scripts that have execute bit set
libcore: remove fails from slice.rs and remove duplicated length checking

core::slice::raw::{shift_ptr,pop_ptr} now returns Option<*T> rather than
*T. They no longer fail on empty slices.

[breaking-change]
Make ProcessOutput Eq, TotalEq, Clone
doc: updates rust manual (loop to continue)

Keyword for continue expressions was changed from loop to continue, but the
manual was not updated.
doc: Update the linkage documentation

After allowing mixing rlibs and dylibs in #13892, the documentation was not
updated accordingly to reflect this new capability.
Remove an unnecessary .move_iter().collect()
Add some long-overdue documentation on the INTERPOLATED helper macros.