diff options
| author | 1hakusai1 <1hakusai1@gmail.com> | 2025-01-16 10:00:30 +0900 |
|---|---|---|
| committer | 1hakusai1 <1hakusai1@gmail.com> | 2025-01-16 10:00:30 +0900 |
| commit | 36d705e04220b246081a20ba671901a6ac80e671 (patch) | |
| tree | 94ac3170f4a34ba55c4ec5ac8b5127efe342e691 /src/tools/rust-analyzer | |
| parent | 7f3601ffab3fc8a595d06689536cd3b34647b284 (diff) | |
| download | rust-36d705e04220b246081a20ba671901a6ac80e671.tar.gz rust-36d705e04220b246081a20ba671901a6ac80e671.zip | |
Use resolve_method_call_as_callable to handle function types
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/goto_definition.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs index 88b8a9f7967..112faa7a659 100644 --- a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs +++ b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs @@ -145,8 +145,9 @@ fn find_definition_for_known_blanket_dual_impls( // - return_type is B (type of b) // We will find the definition of B::from(a: A). let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?; - let receiver_type = sema.type_of_expr(&method_call.receiver()?)?.adjusted(); - let return_type = sema.type_of_expr(&method_call.clone().into())?.original(); + let callable = sema.resolve_method_call_as_callable(&method_call)?; + let (_, receiver_type) = callable.receiver_param(db)?; + let return_type = callable.return_type(); let (search_method, search_trait, return_type) = match method_call.name_ref()?.text().as_str() { "into" => ("from", FamousDefs(sema, krate).core_convert_From()?, return_type), |
