Replace make constructor with syntaxFactory in utils/gen trait fn body#21886
Merged
A4-Tacks merged 6 commits intorust-lang:masterfrom Mar 30, 2026
Merged
Conversation
A4-Tacks
reviewed
Mar 30, 2026
| ) -> Option<ast::Path> { | ||
| let mut iter = parts.into_iter(); | ||
| let base = self.ident_path(iter.next()?); | ||
| let path = iter.fold(base, |base, s| { |
Member
There was a problem hiding this comment.
Why not call make::ext::path_from_idents
Member
Author
There was a problem hiding this comment.
I reverted this change. I had originally implemented the manual construction because all the constituent methods had already been ported to SyntaxFactory.
| } | ||
|
|
||
| pub fn token_tree_from_node(&self, node: &SyntaxNode) -> ast::TokenTree { | ||
| make::ext::token_tree_from_node(node).clone_for_update() |
A4-Tacks
reviewed
Mar 30, 2026
| if let Some(mut mapping) = self.mappings() { | ||
| let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone()); | ||
| let target = ast | ||
| .l_curly_token() |
Member
There was a problem hiding this comment.
This could also be l_paren and l_brack
Member
Author
There was a problem hiding this comment.
Mapping here is itself wrong. My bad for not thinking deeper for this. Considering there is no child of same kind in output. Even the above implementation should panic while casting to a node, considering all the children are token. Removed.
…add mapping for token tree from node constructor
68a2a56 to
b70d09d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the
makeconstructor withSyntaxFactoryingen_trait_fn_body, which directly affects two assists that are also updated in this PR:add_missing_impl_membersreplace_derive_with_manual_implpart of #15710 and #18285