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

Given how much better the AST is from having the receiver be separate, it makes me wonder if HIR would benefit just as much… #100427

Closed
cjgillot opened this issue Aug 11, 2022 · 3 comments
Assignees
Labels
A-hir Area: The high-level intermediate representation (HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@cjgillot
Copy link
Contributor

cjgillot commented Aug 11, 2022

HIR bundles the self expression and the arguments of method calls in a single vector in the hir::ExprKind::MethodCall variant.

Unbundling this in AST in #100232 showed a significant simplification of client code.

Suggested by @nagisa in #100232 (comment)

@cjgillot cjgillot added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. A-hir Area: The high-level intermediate representation (HIR) E-help-wanted Call for participation: Help is requested to fix this issue. labels Aug 11, 2022
@cjgillot
Copy link
Contributor Author

Steps:

  • add an extra &'hir Expr<'hir> field to the hir::ExprKind::MethodCall variant;
  • adapt lowering in rustc_ast_lowering::expr to lower the AST receiver into this field, and not with the arguments;
  • adapt all the using code to use this extra field where they were using the 0th argument (beware the off-by-one lurking in the shadow).

@shourya5
Copy link
Contributor

@rustbot claim

@TaKO8Ki
Copy link
Member

TaKO8Ki commented Sep 5, 2022

#101261

@TaKO8Ki TaKO8Ki closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-hir Area: The high-level intermediate representation (HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. 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

3 participants