Skip to content

Commit

Permalink
Rollup merge of #121863 - lukas-code:silence-mismatched-super-project…
Browse files Browse the repository at this point in the history
…ions, r=lcnr

silence mismatched types errors for implied projections

Currently, if a trait bound is not satisfied, then we suppress any errors for the trait's supertraits not being satisfied, but still report errors for super projections not being satisfied.

For example:
```rust
trait Super {
    type Assoc;
}
trait Sub: Super<Assoc = ()> {}
```
Before this PR, if `T: Sub` is not satisfied, then errors for `T: Super` are suppressed, but errors for `<T as Super>::Assoc == ()` are still shown. This PR makes it so that errors about super projections not being satisfied are also suppressed.

The errors are only suppressed if the span of the trait obligation matches the span of the super predicate obligation to avoid silencing error that are not related. This PR removes some differences between the spans of supertraits and super projections to make the suppression work correctly.

This PR fixes the majority of the diagnostics fallout when making `Thin` a supertrait of `Sized` (in a future PR).
cc rust-lang/rust#120354 (comment)
cc `@lcnr`
  • Loading branch information
GuillaumeGomez authored Mar 7, 2024
2 parents 0bc3cb5 + 3294745 commit 8e71e22
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 8e71e22

Please sign in to comment.