auto merge of #9086 : pcwalton/rust/writeback-port, r=brson

r? @brson or @pnkfelix
auto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajack

r? @metajack or @brson - This pull request makes rustpkg use the workcache library to avoid recompilation.
std::vec: Change fn unzip to take an iterator argument

Remove unzip_slice since it's redundant. Old unzip is equivalent to the
`|x| unzip(x.move_iter())`
ident->name in middle
std::vec: Replace each_permutation with a new Permutations iterator

Introduce ElementSwaps and Permutations. ElementSwaps is an iterator
that for a given sequence length yields the element swaps needed
to visit each possible permutation of the sequence in turn.

We use an algorithm that generates a sequence such that each permutation
is only one swap apart.

    let mut v = [1, 2, 3];
    for perm in v.permutations_iter() {
        // yields 1 2 3 | 1 3 2 | 3 1 2 | 3 2 1 | 2 3 1 | 2 1 3
    }

The `.permutations_iter()` yields clones of the input vector for each
permutation.

If a copyless traversal is needed, it can be constructed with
`ElementSwaps`:

    for (a, b) in ElementSwaps::new(3) {
        // yields (2, 1), (1, 0), (2, 1) ...
        v.swap(a, b);
        // ..
    }
std::vec: Update module doc text

Update for a lot of changes (not many free functions left), add examples
of the important methods `slice` and `push`, and write a short bit about
iteration.
std::vec: Remove the function same_length

The basic construct x.len() == y.len() is just as simple.

This function used to be a precondition (not sure about the
terminology), so it had to be a function. This is not relevant any more.
std::at_vec and vec: Unify build_sized, build_sized_opt into build

These functions have very few users since they are mostly replaced by
iterator-based constructions.

Convert a few remaining users in-tree, and reduce the number of
functions by basically renaming build_sized_opt to build, and removing
the other two. This for both the vec and the at_vec versions.
undo cowardly hiding of eq-check

I've reversed my thinking on this restrictive definition of eq after
two separate bugs were hidden by commenting it out; it's better to
get ICEs than SIGSEGV's, any day.

RE-ENABLING ICE MACHINE!
auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichton

Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations.

Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument.

Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end.

Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`.

Remove `equal_sizes`
added run-pass test for issue #9049
auto merge of #9076 : blake2-ppc/rust/test-for-8585, r=huonw

The issue #8587 is fixed (the original testcase now passes); add that testcase to the suite.


Fixes #8587.
Remove oldvisit.rs (yay!); part of #7081 refactoring.
auto merge of #9090 : jbclements/rust/let-var-hygiene, r=luqmana

This appears to fix issue #9049. It also re-enables the ICE check on comparing idents for equality; it appears that ICEs are better than seg faults.
check_loans.rs Visitor refactoring (#7081): unify CheckLoan{Ctxt,Visitor}.
gather_loans/mod.rs Visitor refactoring (#7081): unify GatherLoan{Ctxt,Visitor}.
middle/entry.rs Visitor refactoring (#7081): unify Entry{Context,Visitor}.
Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, r=catamorphism

Ensures that each AST node has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
auto merge of #9094 : pnkfelix/rust/fsk-visitor-ports, r=huonw

r? anyone

Remove some trivial Visitor structs, using their non-trivial Contexts as the Visitor implementation instead.

Removed a little bit of `@boxing` as well.

Part of ongoing work on #7081.