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

Remove P<> from visit_s in ast MutVisitor #132112

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

maxcabrajac
Copy link
Contributor

@maxcabrajac maxcabrajac commented Oct 24, 2024

On #128974, one divergence I found between versions of the trait were P<> wrappers on some types on the mutable one.
Some are really easy to remove, while others are not.
This PR tries to remove them.

r? @petrochenkov

related to #128974 & #127615

@rustbot
Copy link
Collaborator

rustbot commented Oct 24, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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 Oct 24, 2024
@maxcabrajac maxcabrajac marked this pull request as draft October 24, 2024 16:47
@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 Oct 24, 2024
@petrochenkov
Copy link
Contributor

(The PR was marked as a draft, so I assumed you want to try removing the rest of P<>s.)

@maxcabrajac
Copy link
Contributor Author

Yup, that was the idea... But I'm starting to think this might not be a good one. From the Vistor's perspective it surely is, but when I looked at how rustc_expand heavily uses substitution on this P<>s it seems not to be great to remove them.

I'll look deeper into it on the weekend and keep you up to date!

If I end up finding a way to remove them from the visits then its best that we do another perf test.

@rust-log-analyzer

This comment has been minimized.

@maxcabrajac
Copy link
Contributor Author

For now, I removed P<>s from all visits, but this just pushed the problem into rustc_expand. What I see as the problem now is calling .into_inner() on the P<>s we get from .make_*() methods. A better approach is to change them to return T instead of P<T>. This would possibly remove some memory allocations, which I see as a good thing!

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Oct 27, 2024

☔ The latest upstream changes (presumably #131284) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants