Skip to content

[WIP] Move placeholder error handling to before region inference #142623

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

amandasystems
Copy link
Contributor

@amandasystems amandasystems commented Jun 17, 2025

This PR breaks out yet another part of #130227. It prepares for the removal of precise placeholder tracking by colocating detecting placeholder errors for higher-ranked relations (placeholders outliving existentials that can't name them, other placeholders) with the preprocessing step that adds outlives-static constraints.

For stepping-on-toes reasons it is currently based on #140737, but can be rebased on regular master and merged separately nope that's a terrible idea actually, it relies on some of the tracking introduced there.

This step also makes region errors more fine-grained, which is useful to simplify the error reporting pipeline, which is currently based on a very brittle method of reconstructing an error event after the fact to figure out what went wrong. Doing that is left as future work, though.

This changes the logic of error reporting slightly to not emit errors for placeholder/higher kinded constraints if there are other borrowck errors. This somewhat lessens the flood of errors and was described as if anything an improvement by @nikomatsakis in informal review.

r? lcnr

WIP waiting for #140737 to land.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 17, 2025
@rust-log-analyzer

This comment has been minimized.

@amandasystems
Copy link
Contributor Author

Wow, a merge conflict with upstream for a commit I JUST PUSHED, that's record time!

@amandasystems amandasystems force-pushed the early-placeholder-errors branch from ad7b52c to fd18095 Compare June 17, 2025 14:33
Revise the extra `r: 'static` constraints added upon universe issues
to add an explanation, and use that explanation during constraint blame
search. This greatly simplifies the region inference logic, which
now does not need to reverse-engineer the event that caused a region
to outlive 'static.
@amandasystems amandasystems force-pushed the early-placeholder-errors branch from fd18095 to 199f961 Compare June 17, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

4 participants