Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reporting for trait cycles could be improved #30974

Closed
nikomatsakis opened this issue Jan 17, 2016 · 3 comments
Closed

Error reporting for trait cycles could be improved #30974

nikomatsakis opened this issue Jan 17, 2016 · 3 comments
Labels
A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

The new fulfillment context from #30533 can detect and extract cycles in the trait resolution graph, but (for the most part) it still reports them the same way as any other overflow. We can do a lot better. In fact, it does do a lot better, for the Sized trait in particular. This machinery could surely be adopted:

  • We should be able to print out the full cycle.
  • We should be able to avoid suggesting increasing the overflow limit, as that will not help.

We could probably stop aborting compilation too, but it'd be just a touch trickier. I think the most correct thing would be to refactor the fulfillment context interface to transmit back "overflow" as a distinct category from other errors. This is because overflow seems different from the absence of an impl. OTOH, I'm not sure if this matters in practice, particularly if we adapt the way we handle negative reasoning. Perhaps the absence of an impl and overflow can both be treated as an error in that case.

cc @aturon @arielb1

@nikomatsakis nikomatsakis added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-traits Area: Trait system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 17, 2016
@steveklabnik
Copy link
Member

Triage: I'm not aware of any changes here, but this isn't my area of specialty either.

@estebank
Copy link
Contributor

estebank commented Apr 18, 2018

cc #49950

@oskgo
Copy link
Contributor

oskgo commented Jan 24, 2024

Since the fix (#49950) has been merged this should be closed.

Some diagnostics examples can be found in the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants