diff options
author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-05-02 11:44:51 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 11:44:51 +0530 |
commit | be4f9f5becf15d0319a2862f5e76b7993a56951a (patch) | |
tree | 2fa6834ca5a2e67f7ea99923e38b4bf6afda9d56 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs | |
parent | f379a58bf2aca99429870610529e24c97abaf1b8 (diff) | |
parent | bec7193072649d7493091de1191fd739645037d6 (diff) | |
download | rust-be4f9f5becf15d0319a2862f5e76b7993a56951a.tar.gz |
Rollup merge of #110512 - compiler-errors:fix-elaboration-with-associated-type-bounds, r=spastorino
Fix elaboration with associated type bounds
When computing a trait's supertrait predicates, do not add any associated type *trait* bounds to that list of supertrait predicates. This is because supertrait predicates are expected to have the same `Self` type as the trait.
For example, given:
```rust
trait Foo: Bar<Assoc: Send>
```
Before, we would compute that the supertrait predicates of `T: Foo` are `T: Bar` and `<T as Bar>::Assoc: Send`. However, the last bound is a trait predicate for a totally different type than `T`, and existing code that uses supertrait bounds such as vtable construction, closure fn signature deduction, etc. all rely on the invariant that we have a list of predicates for self type `T`.
Fixes #76593
The reason for all the extra diagnostic noise is that we're recomputing predicates with a different filter now. These diagnostics should be deduplicated for any end-user though.
---
This does bring up an interesting question -- is the predicate `<T as Bar>::Assoc: Send` an implied bound of `T: Foo`? Because currently the only bounds implied by a (non-alias) trait are its supertraits. I guess I could fix this too, but it would require even more changes, and I'm inclined to punt this question along.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions