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

More specific errors for kind check failures #12201

Closed
nikomatsakis opened this issue Feb 12, 2014 · 2 comments
Closed

More specific errors for kind check failures #12201

nikomatsakis opened this issue Feb 12, 2014 · 2 comments
Labels
A-typesystem Area: The type system C-enhancement Category: An issue proposing an enhancement or a PR with one. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@nikomatsakis
Copy link
Contributor

Today if a type is not Send (or whatever) you get a rather terse error message informing you of that fact, but no clue as to why a type isn't send. It shouldn't be too hard to walk over the type, identifying a specific path that leads to a non-sendable type. (Same holds for linearity etc)

I'm happy to mentor, so tagging as E-mentor.

cc @larsbergstrom

@nikomatsakis
Copy link
Contributor Author

This was discussed some on IRC. To clarify the consensus, the basic strategy we had in mind is to:

  1. Refactor TypeContents into a visitor that walks the, well, type contents.
  2. TypeContents uses this visitor to compute its bitsets.
  3. In the case of an error, a separate path of code uses the visitor to walk down and compute a "path" from the type to the smallest error case. Something like "this is not send because x.y.z is not sendable". This path probably has the same form as the paths that the borrow checker reports, though it may not use the same data structures.

The reason for this approach is that we do not want to compute nor store the full paths in the normal case, since TypeContents are computed for a LOT of types, and only a very few of them have errors.

@nikomatsakis
Copy link
Contributor Author

@flaper87 did this as part of the OIBIT work.

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
fix: Add cast expressions to param name inlay hint heuristics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system C-enhancement Category: An issue proposing an enhancement or a PR with one. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

2 participants