Re-implement lint with less emphasis on item ids

This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted.
Optimize lint passes to perform far fewer allocations

Achieves ~3x speedup on lint passes for libcore
Change lints to indicate exactly where the level was set
auto merge of #6093 : alexcrichton/rust/issue-2647, r=thestinger

Closes #2647

This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted. This involved pretty much rewriting how lints are emitted. Beforehand, only items could alter the lint settings, so whenever a lint was added it had to be associated with whatever item id it was coming from. I removed this (possibly questionably) in favor of just specifying a span and a message when adding a lint. When lint checking comes around, it looks at all the lints and sees which node with attributes best encloses it and uses that level of linting. This means that all consumer code doesn't have to deal with what item things came from (especially because functions on impls aren't items). More details of this can be found in the code (and comments).

As a bonus, I managed to greatly simplify emission of lints in resolve.rs about unused imports. Now instead of it manually tracking what the lint level is, it's all moved over into the lint module (as is to be expected).