Skip to content

Replace direct usage of make with syntax factory and migrate assist to syntaxEditor#21847

Merged
A4-Tacks merged 6 commits intorust-lang:masterfrom
Shourya742:2026-03-20-migrate-assist
Mar 20, 2026
Merged

Replace direct usage of make with syntax factory and migrate assist to syntaxEditor#21847
A4-Tacks merged 6 commits intorust-lang:masterfrom
Shourya742:2026-03-20-migrate-assist

Conversation

@Shourya742
Copy link
Member

@Shourya742 Shourya742 commented Mar 20, 2026

This PR migrates direct use of make in assist with methods from syntax Factory, it also make migrates a couple of assists to SyntaxEditor and Syntax Factory, which are qualify_method_call, qualify_path and desugar_try_expr

part of #15710 and #18285

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2026
let fake_expr_let =
ast::make::expr_let(ast::make::tuple_pat(None).into(), ast::make::ext::expr_unit());
fn let_expr_needs_paren(expr: &ast::Expr, make: &SyntaxFactory) -> bool {
let fake_expr_let = make.expr_let(make.tuple_pat(None).into(), make.expr_unit());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not require mapping, or even a mutable tree

Copy link
Member Author

@Shourya742 Shourya742 Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That thought occurred to me as well while migrating, but I wasn’t sure whether it makes sense to introduce a new constructor method for this. Curious to hear your suggestion, ideally without reusing make directly. For now, I used without_mapping variant here, at least to avoid the mapping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I wasn’t sure whether it makes sense to introduce a new constructor method for this.

It seems that the goal is to completely remove the mutable tree?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

@A4-Tacks A4-Tacks added this pull request to the merge queue Mar 20, 2026
Merged via the queue into rust-lang:master with commit 0cf3e8a Mar 20, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants