diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-30 15:23:21 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-30 15:23:21 +0000 |
commit | f408ff50130eae0eb56e7f9668e9df39f7baa6dd (patch) | |
tree | 099e32b0fb1f94bef58d6d9a23d45d2e8b890ae1 /crates/hir_ty/src/diagnostics | |
parent | 557c1e36ddbb19cc76f7a1f04d1b327942aafcb9 (diff) | |
parent | e3eeccf8ef2029bb54ba05af420a65b429763477 (diff) |
Merge #7483
7483: Classify function calls as functions when shadowed by types r=matklad a=Veykril
Fixes #7479
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/diagnostics')
-rw-r--r-- | crates/hir_ty/src/diagnostics/unsafe_check.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/crates/hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs index 6dc862826..9c506112d 100644 --- a/crates/hir_ty/src/diagnostics/unsafe_check.rs +++ b/crates/hir_ty/src/diagnostics/unsafe_check.rs | |||
@@ -12,8 +12,7 @@ use hir_def::{ | |||
12 | use hir_expand::diagnostics::DiagnosticSink; | 12 | use hir_expand::diagnostics::DiagnosticSink; |
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | db::HirDatabase, diagnostics::MissingUnsafe, lower::CallableDefId, ApplicationTy, | 15 | db::HirDatabase, diagnostics::MissingUnsafe, ApplicationTy, InferenceResult, Ty, TypeCtor, |
16 | InferenceResult, Ty, TypeCtor, | ||
17 | }; | 16 | }; |
18 | 17 | ||
19 | pub(super) struct UnsafeValidator<'a, 'b: 'a> { | 18 | pub(super) struct UnsafeValidator<'a, 'b: 'a> { |
@@ -87,13 +86,8 @@ fn walk_unsafe( | |||
87 | ) { | 86 | ) { |
88 | let expr = &body.exprs[current]; | 87 | let expr = &body.exprs[current]; |
89 | match expr { | 88 | match expr { |
90 | Expr::Call { callee, .. } => { | 89 | &Expr::Call { callee, .. } => { |
91 | let ty = &infer[*callee]; | 90 | if let Some(func) = infer[callee].as_fn_def() { |
92 | if let &Ty::Apply(ApplicationTy { | ||
93 | ctor: TypeCtor::FnDef(CallableDefId::FunctionId(func)), | ||
94 | .. | ||
95 | }) = ty | ||
96 | { | ||
97 | if db.function_data(func).is_unsafe { | 91 | if db.function_data(func).is_unsafe { |
98 | unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block }); | 92 | unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block }); |
99 | } | 93 | } |