How about a less cringe-worthy double-failure message?
mk: Move rust_test_helpers out of libstd

There's no need to distribute these ABI helpers for tests with the standard rust
distribution they're only needed for our tests.

Closes #2665
auto merge of #14676 : brson/rust/double-rainbow, r=alexcrichton
auto merge of #14677 : alexcrichton/rust/issue-2665, r=brson

There's no need to distribute these ABI helpers for tests with the standard rust
distribution they're only needed for our tests.

Closes #2665
Clean up check_loans.

Refactor a number of functions in check_loans to take node IDs and spans
rather than taking expressions directly. Also rename some variables to
make them less ambiguous.

This is the first step towards using ExprUseVisitor in check_loans, as
now some of the interfaces more closely match those used in
ExprUseVisitor.
Fix mem_categorization to treat an AutoObject adjustment as an rvalue.

Currently mem_categorization categorizes an AutoObject adjustment the
same as the original expression. This can cause two moves to be
generated for the same underlying expression. Currently this isn't a
problem in practice, since check_loans doesn't rely on ExprUseVisitor.
Add an Init mode to MutateMode.

This isn't necessary right now, but check_loans needs to be able to
distinguish between initialization and writes in the ExprUseVisitor
mutate callback.
Add a move reason to the Move ConsumeMode.

Currently it is not possible to distinguish moves caused by captures
in the ExprUseVisitor interface. Since check_Loans needs to make that
distinction for generating good diagnostics, this is necessary for
check_loans to switch to ExprUseVisitor.
Use the MoveReason to determine a more precise MoveKind in gather_moves.
Add a kind_of_move_of_path method to FlowedMoveData.
Change check_loans to use ExprUseVisitor.
Add new tests for borrowck field-sensitivity.
Add a test for borrowck errors with multiple closure captures.

When converting check_loans to use ExprUseVisitor I encountered a few
issues where the wrong number of errors were being emitted for multiple
closure captures, but there is no existing test for this.
auto merge of #14318 : zwarich/rust/check-loans-refactor, r=nikomatsakis

I tried to split up the less mechanical changes into separate commits so they are easier to review. One thing I'm not quite sure of is whether `MoveReason` should just be replaced with `move_data::MoveKind`.
Move subst data structures into subst.rs, fix capitalization
Simplify MonoId not to include parameters which, given coherence, are purely derived
Move Def out of syntax crate, where it does not belong
Stop passing around Option<&substs> in trans and just pass &substs, making the code more regular
Add missing test case for contravariant trait matching
Fix resolve to not permit refs to type vars from outer fns
(Fixes #14603)