suppress projection errors already covered by a trait error - #161088
Open
Albab-Hasan wants to merge 1 commit into
Open
suppress projection errors already covered by a trait error#161088Albab-Hasan wants to merge 1 commit into
Albab-Hasan wants to merge 1 commit into
Conversation
under the next solver a closure whose signature doesnt match emitted two errors at the same span. the trait goal `C: FnMut(&i32)` failed, and the `<C as FnOnce<..>>::Output == bool` projection goal resting on it failed out of that same unification. the old solver collapses both into a single `type mismatch in closure arguments`, so the projection error was noise. suppress a projection error when another error at the same span is a trait goal it rests on. ambiguity errors are exempt, they get merged into one diagnostic whose notes list every constraint the annotation has to satisfy, so their projections still say something the trait error doesnt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
under the next solver a closure whose signature doesnt match emits both the trait goal error and the
<C as FnOnce<..>>::Output == ..projection error that falls out of that same failed unification. the suppression pass only compared trait goals against trait goals and projections against projections so it never saw a projection resting on a trait goal that already errored at the same span. suppress those. ambiguity errors are exempt. they get merged into one diagnostic listing every constraint.one note. the suppressed error in
iterator-item-suggest-no-icecarried a method chain note the surviving error doesnt have, so that case loses output and not just a duplicate.follow up to #159839 (comment)
r? @oli-obk
cc @estebank