diff options
Diffstat (limited to 'crates/ra_hir_ty/src/expr.rs')
-rw-r--r-- | crates/ra_hir_ty/src/expr.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index 7532e2dc7..04668f486 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs | |||
@@ -329,13 +329,28 @@ pub fn unsafe_expressions( | |||
329 | match expr { | 329 | match expr { |
330 | Expr::Call { callee, .. } => { | 330 | Expr::Call { callee, .. } => { |
331 | if infer | 331 | if infer |
332 | .method_resolution(*callee) | 332 | .method_resolution(/* id */ *callee) |
333 | .map(|func| db.function_data(func).is_unsafe) | 333 | .map(|func| db.function_data(func).is_unsafe) |
334 | .unwrap_or(false) | 334 | .unwrap_or(false) |
335 | { | 335 | { |
336 | unsafe_expr_ids.push(id); | 336 | unsafe_expr_ids.push(id); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | Expr::MethodCall {/*_receiver, method_name,*/ .. } => { | ||
340 | // let receiver_ty = &infer.type_of_expr[*receiver]; | ||
341 | // receiver_ty | ||
342 | if infer | ||
343 | .method_resolution(id) | ||
344 | .map(|func| { | ||
345 | db.function_data(func).is_unsafe | ||
346 | }) | ||
347 | .unwrap_or_else(|| { | ||
348 | false | ||
349 | }) | ||
350 | { | ||
351 | unsafe_expr_ids.push(id); | ||
352 | } | ||
353 | } | ||
339 | Expr::UnaryOp { expr, op: UnaryOp::Deref } => { | 354 | Expr::UnaryOp { expr, op: UnaryOp::Deref } => { |
340 | if let Ty::Apply(ApplicationTy { ctor: TypeCtor::RawPtr(..), .. }) = &infer[*expr] { | 355 | if let Ty::Apply(ApplicationTy { ctor: TypeCtor::RawPtr(..), .. }) = &infer[*expr] { |
341 | unsafe_expr_ids.push(id); | 356 | unsafe_expr_ids.push(id); |