diff options
author | Paul Daniel Faria <[email protected]> | 2020-05-24 07:10:34 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-06-27 15:09:29 +0100 |
commit | b358fbfdf82409700a8a328794429ec790306fc2 (patch) | |
tree | c21ff40842d2141f2b3043d3ccef9e9222157ed8 /crates/ra_hir_ty/src/expr.rs | |
parent | daf1cac9f87023d37a4418ea24ed615c9706258b (diff) |
Add tests covering unsafe blocks, more attempts to get call expr tests passing
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); |