Skip to content

Simplify the item info collection visitor running before late resolution - #160515

Closed
oli-obk wants to merge 4 commits into
rust-lang:mainfrom
oli-obk:item_info_shrink
Closed

Simplify the item info collection visitor running before late resolution#160515
oli-obk wants to merge 4 commits into
rust-lang:mainfrom
oli-obk:item_info_shrink

Conversation

@oli-obk

@oli-obk oli-obk commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

r? @petrochenkov

I mainly want 52cc1ac (use item collection in late resolution visitor), as my first step to refactor use item lowering needs to track the owner, which the info collection visitor doesn't do right now, and it seems annoying to add when there is a perfectly good visitor already tracking it right there.

I tried getting rid of the info collection visitor entirely, but counting the number of generic lifetime parameters of free items is necessary for diagnostics in the late visitor when visiting paths. A path can refer to an item that is visited later, so we haven't recorded the number of generic lifetime parameters yet (if we do it in the late visitor). If we collect them in the def collector, we have to handle macro invocations in generic parameter definition position. It wasn't clear to me how to handle that without severe spaghetti code, so the visitor stays around for now.

@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 Aug 4, 2026
@petrochenkov

petrochenkov commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

counting the number of generic lifetime parameters of free items is necessary for diagnostics in the late visitor when visiting paths

Same is true for delegation_fn_sigs and item_required_generic_args_suggestions, both are used in compiler\rustc_resolve\src\late\diagnostics.rs in "out of order" way (and not just for delegations, before delegations that table was called fn_has_self or something like that). Upd: delegation_fn_sigs is no longer used for delegation lowering anymore, it again acts only as fn_has_self.

Not sure about resolve_eii.

At least use_items doesn't seem to be affected.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2026
@oli-obk

oli-obk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

I'll put the use_items commit directly into the PR that needs it

@oli-obk oli-obk closed this Aug 5, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants