Skip to content

silence mismatched types errors for implied projections - #121863

Merged
bors merged 6 commits into
rust-lang:masterfrom
lukas-code:silence-mismatched-super-projections
Mar 7, 2024
Merged

bors merged 6 commits into
rust-lang:masterfrom
lukas-code:silence-mismatched-super-projections

Conversation

@lukas-code

Copy link
Copy Markdown
Contributor

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:

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 #120354 (comment)
cc @lcnr

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants