aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/semantics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r--crates/hir/src/semantics.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 621ebcbe3..cabeaaf98 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -21,13 +21,13 @@ use syntax::{
21}; 21};
22 22
23use crate::{ 23use crate::{
24 code_model::Access,
24 db::HirDatabase, 25 db::HirDatabase,
25 diagnostics::Diagnostic, 26 diagnostics::Diagnostic,
26 semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx}, 27 semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
27 source_analyzer::{resolve_hir_path, SourceAnalyzer}, 28 source_analyzer::{resolve_hir_path, SourceAnalyzer},
28 AssocItem, Callable, Crate, Field, Function, HirFileId, ImplDef, InFile, Local, MacroDef, 29 AssocItem, Callable, Crate, Field, Function, HirFileId, ImplDef, InFile, Local, MacroDef,
29 Module, ModuleDef, Name, Origin, Path, ScopeDef, Trait, Type, TypeAlias, TypeParam, TypeRef, 30 Module, ModuleDef, Name, Origin, Path, ScopeDef, Trait, Type, TypeAlias, TypeParam, VariantDef,
30 VariantDef,
31}; 31};
32 32
33#[derive(Debug, Clone, PartialEq, Eq)] 33#[derive(Debug, Clone, PartialEq, Eq)]
@@ -627,9 +627,11 @@ impl<'db> SemanticsImpl<'db> {
627 } 627 }
628 628
629 let func = self.resolve_method_call(&method_call_expr).map(Function::from)?; 629 let func = self.resolve_method_call(&method_call_expr).map(Function::from)?;
630 let is_unsafe = func.has_self_param(self.db) 630 let res = match func.self_param(self.db)?.access(self.db) {
631 && matches!(func.params(self.db).first(), Some(TypeRef::Reference(..))); 631 Access::Shared | Access::Exclusive => true,
632 Some(is_unsafe) 632 Access::Owned => false,
633 };
634 Some(res)
633 }) 635 })
634 .unwrap_or(false) 636 .unwrap_or(false)
635 } 637 }