rust-analyzer/crates
Dorian Scheidt 075ab03851 fix: Support generics in extract_function assist
This change attempts to resolve issue #7636: Extract into Function does not
create a generic function with constraints when extracting generic code.

In `FunctionBody::analyze_container`, we now traverse the `ancestors` in search
of `AnyHasGenericParams`, and attach any `GenericParamList`s and `WhereClause`s
we find to the `ContainerInfo`.

Later, in `format_function`, we collect all the `GenericParam`s and
`WherePred`s from the container, and filter them to keep only types matching
`TypeParam`s used within the newly extracted function body or param list. We
can then include the new `GenericParamList` and `WhereClause` in the new
function definition.

This change only impacts `TypeParam`s. `LifetimeParam`s and `ConstParam`s are
out of scope for this change.
2022-07-13 14:54:10 -05:00
..
base-db Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
cfg internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
flycheck Bump cargo_metadata 2022-07-03 10:09:35 +03:00
hir fix: Support generics in extract_function assist 2022-07-13 14:54:10 -05:00
hir-def Implement ignore and index metavar expression 2022-07-11 18:31:42 +02:00
hir-expand Auto merge of #12719 - davidlattimore:format-args-no-unsafe, r=jonas-schievink 2022-07-08 14:10:19 +00:00
hir-ty Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
ide Fix typos 2022-07-11 21:42:05 +08:00
ide-assists fix: Support generics in extract_function assist 2022-07-13 14:54:10 -05:00
ide-completion Fix obsolete completion.snippets config 2022-07-11 17:00:40 +09:00
ide-db Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
ide-diagnostics Auto merge of #12696 - hi-rustin:rustin-patch-fix, r=Veykril 2022-07-13 09:57:51 +00:00
ide-ssr internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
limit Use compare_exchange_weak in limit::Limit::check 2022-01-28 18:19:35 +03:00
mbe Implement ignore and index metavar expression 2022-07-11 18:31:42 +02:00
parser Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
paths Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
proc-macro-api Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
proc-macro-srv Update 1.63 proc macro ABI to match rustc 2022-07-12 15:19:31 +02:00
proc-macro-test Bump cargo_metadata 2022-07-03 10:09:35 +03:00
profile Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
project-model Fix rustcSource -> rustc_source 2022-07-11 16:50:20 +09:00
rust-analyzer Fix obsolete enableRangeFormatting config 2022-07-11 16:52:35 +09:00
sourcegen Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
stdx Polish 2022-06-15 18:35:48 +02:00
syntax Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
test-utils internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
text-edit style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
toolchain Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
tt internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
vfs Bump indexmap 2022-07-03 10:09:35 +03:00
vfs-notify Bump crossbeam-channel 2022-07-03 09:56:58 +03:00