Fix leaking trait imports across modules

Turns out the pass in resolve was a little too eager to travel back up the
hierarchy chain when looking for trait candidates.

Closes #10465
rustc: De-indent portions of middle::resolve

It's a little prettier to look at now
std: Fill in all missing imports

Fallout from the previous commits
Fix remaining cases of leaking imports
stdtest: Fix all leaked trait imports
extratest: Fix all leaked trait imports
Fixup the rest of the tests in the compiler
auto merge of #11370 : alexcrichton/rust/issue-10465, r=pcwalton

Turned out to be a 2-line fix, but the compiler fallout was huge.