forked from rust-lang/rust-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Extract Function assist with generics
This change attempts to resolve issue rust-lang#7637: Extract into Function does not create a generic function with constraints when extracting generic code. In `FunctionBody::analyze_container`, when the ancestor matches `ast::Fn`, we can perserve both the `generic_param_list` and the `where_clause`. These can then be included in the newly extracted function output via `format_function`. From what I can tell, the only other ancestor type that could potentially have a generic param list would be `ast::ClosureExpr`. In this case, we perserve the `generic_param_list`, but no where clause is ever present. In this inital implementation, all the generic params and where clauses from the parent function will be copied to the newly extracted function. An obvious improvement would be to filter this output in some way to only include generic parameters that are actually used in the function body. fixes rust-lang#7636
- Loading branch information
1 parent
65874df
commit ecc3a48
Showing
1 changed file
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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