diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-08 11:52:43 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-08 11:52:43 +0000 |
commit | 596e6db46c9c79b2b2be20a4b5461dca35d44b0f (patch) | |
tree | e2ed14ae5aaf7756b1b8f19eaf1318102bd9a26b /crates/ra_cli | |
parent | 7a6b6ed0a5311cabee9d68a89100aed46523243b (diff) | |
parent | e2cc55207619f987fd5cc274628b8e49e15ec856 (diff) |
Merge #2499
2499: Remove ty from code_model r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_cli')
-rw-r--r-- | crates/ra_cli/Cargo.toml | 4 | ||||
-rw-r--r-- | crates/ra_cli/src/analysis_stats.rs | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/crates/ra_cli/Cargo.toml b/crates/ra_cli/Cargo.toml index 21a37c7bf..12af075f7 100644 --- a/crates/ra_cli/Cargo.toml +++ b/crates/ra_cli/Cargo.toml | |||
@@ -12,7 +12,9 @@ env_logger = { version = "0.7.1", default-features = false, features = ["humanti | |||
12 | ra_syntax = { path = "../ra_syntax" } | 12 | ra_syntax = { path = "../ra_syntax" } |
13 | ra_ide = { path = "../ra_ide" } | 13 | ra_ide = { path = "../ra_ide" } |
14 | ra_batch = { path = "../ra_batch" } | 14 | ra_batch = { path = "../ra_batch" } |
15 | ra_hir = { path = "../ra_hir" } | 15 | hir = { path = "../ra_hir", package = "ra_hir" } |
16 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } | ||
17 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } | ||
16 | ra_db = { path = "../ra_db" } | 18 | ra_db = { path = "../ra_db" } |
17 | 19 | ||
18 | [dependencies.ra_prof] | 20 | [dependencies.ra_prof] |
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs index 9b1802a5f..ac65415a5 100644 --- a/crates/ra_cli/src/analysis_stats.rs +++ b/crates/ra_cli/src/analysis_stats.rs | |||
@@ -2,8 +2,13 @@ | |||
2 | 2 | ||
3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; | 3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; |
4 | 4 | ||
5 | use hir::{ | ||
6 | db::{DefDatabase, HirDatabase}, | ||
7 | AssocItem, Crate, HasSource, HirDisplay, ModuleDef, | ||
8 | }; | ||
9 | use hir_def::FunctionId; | ||
10 | use hir_ty::{Ty, TypeWalk}; | ||
5 | use ra_db::SourceDatabaseExt; | 11 | use ra_db::SourceDatabaseExt; |
6 | use ra_hir::{AssocItem, Crate, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; | ||
7 | use ra_syntax::AstNode; | 12 | use ra_syntax::AstNode; |
8 | 13 | ||
9 | use crate::{progress_report::ProgressReport, Result, Verbosity}; | 14 | use crate::{progress_report::ProgressReport, Result, Verbosity}; |
@@ -101,8 +106,9 @@ pub fn run( | |||
101 | continue; | 106 | continue; |
102 | } | 107 | } |
103 | } | 108 | } |
104 | let body = f.body(db); | 109 | let f_id = FunctionId::from(f); |
105 | let inference_result = f.infer(db); | 110 | let body = db.body(f_id.into()); |
111 | let inference_result = db.infer(f_id.into()); | ||
106 | for (expr_id, _) in body.exprs.iter() { | 112 | for (expr_id, _) in body.exprs.iter() { |
107 | let ty = &inference_result[expr_id]; | 113 | let ty = &inference_result[expr_id]; |
108 | num_exprs += 1; | 114 | num_exprs += 1; |
@@ -122,7 +128,8 @@ pub fn run( | |||
122 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { | 128 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { |
123 | num_type_mismatches += 1; | 129 | num_type_mismatches += 1; |
124 | if verbosity.is_verbose() { | 130 | if verbosity.is_verbose() { |
125 | let src = f.body_source_map(db).expr_syntax(expr_id); | 131 | let (_, sm) = db.body_with_source_map(f_id.into()); |
132 | let src = sm.expr_syntax(expr_id); | ||
126 | if let Some(src) = src { | 133 | if let Some(src) = src { |
127 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly | 134 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly |
128 | let original_file = src.file_id.original_file(db); | 135 | let original_file = src.file_id.original_file(db); |