librustc: Implement coercion for traits.
Add tests for trait object coercion.
auto merge of #11156 : luqmana/rust/trait-object-coercion, r=pcwalton

This ports over @pcwalton's old pull that bitrotted (#5597). Fixes #10039.

r? @pcwalton / @nikomatsakis