Improve diagnostics for non-well-formed associated items - #162432
Open
ozankenangungor wants to merge 1 commit into
Open
Improve diagnostics for non-well-formed associated items#162432ozankenangungor wants to merge 1 commit into
ozankenangungor wants to merge 1 commit into
Conversation
Collaborator
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
Collaborator
|
rustbot has assigned @ShoyuVanilla. Use Why was this reviewer chosen?The reviewer was selected based on:
|
maxdexh
reviewed
Sep 7, 2026
ozankenangungor
force-pushed
the
issue-162368
branch
from
September 7, 2026 23:18
8797677 to
83aeb8a
Compare
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.
Fixes #162368.
With the new solver, this ended up as a projection mismatch instead of reporting the
Sizedrequirement from the associated type.I changed the diagnostic fallback to also check the associated item's own clauses, so it can recover the
Self: Sizedobligation and report E0277 instead.In this case, the diagnostic now points to the impl type parameter instead of
i32, keeps the note for the associated type bound, and suggests addingwhere Self: Sized.I also added regression tests for the original case, an existing where-clause, the normal implicit
Sizedcase, and a non-impl projection use site.