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