diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index fc4f56550..5521fd2b1 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -4,7 +4,7 @@ mod injection; | |||
4 | #[cfg(test)] | 4 | #[cfg(test)] |
5 | mod tests; | 5 | mod tests; |
6 | 6 | ||
7 | use hir::{Name, SelfKind, Semantics, VariantDef}; | 7 | use hir::{Name, Semantics, VariantDef}; |
8 | use ide_db::{ | 8 | use ide_db::{ |
9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, |
10 | RootDatabase, | 10 | RootDatabase, |
@@ -720,15 +720,21 @@ fn highlight_method_call( | |||
720 | if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) { | 720 | if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) { |
721 | h |= HighlightModifier::Unsafe; | 721 | h |= HighlightModifier::Unsafe; |
722 | } | 722 | } |
723 | 723 | if let Some(self_param) = func.self_param(sema.db) { | |
724 | sema.method_reciever_kind(&method_call) | 724 | match self_param.access(sema.db) { |
725 | .map(|self_kind| match self_kind { | 725 | hir::Access::Shared => (), |
726 | SelfKind::Shared => h, | 726 | hir::Access::Exclusive => h |= HighlightModifier::Mutable, |
727 | SelfKind::Mutable => h | HighlightModifier::Mutable, | 727 | hir::Access::Owned => { |
728 | SelfKind::Consuming => h | HighlightModifier::Consuming, | 728 | if let Some(receiver_ty) = method_call.expr().and_then(|it| sema.type_of_expr(&it)) |
729 | SelfKind::Copied => h, | 729 | { |
730 | }) | 730 | if !receiver_ty.is_copy(sema.db) { |
731 | .or_else(|| Some(h)) | 731 | h |= HighlightModifier::Consuming |
732 | } | ||
733 | } | ||
734 | } | ||
735 | } | ||
736 | } | ||
737 | Some(h) | ||
732 | } | 738 | } |
733 | 739 | ||
734 | fn highlight_name( | 740 | fn highlight_name( |