This still looks wrong. I don't think we can key on def-id. I think you just need to remove this set and do something simpler. I imagine two nested loops (here I wrote it using filter/any). Basically you want to know: Are there any impl bounds which are not implied by some trait bound? If so, that's an error.

```
let failed_bounds =
    impl_bounds.filter(|ib| trait_bounds.any(|tb| implies(infcx, tb, ib)));
fn implies(infcx, trait_bound, impl_bound) {
    is impl_bound a sub trait ref of trait_bound?
}
```

Note that this doesn't take the *full* generality into account that we could. e.g., If the trait has Ord and the impl has Eq, that should be ok. We should be able to do that too; it's a matter of expanding out the "trait_bounds" vector to account for super bounds (or possibly changing mk_sub_trait_refs, I've been debating that in my head just now). But I think we can leave that aside for now, it'd really only be important for #5236 which is not on the table presently.