From 9c3b25177e3c8d609dd24d2c2e01cbb82cab665f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 3 Sep 2019 11:04:38 +0300 Subject: Correctly build BodySourceMap for macro-expanded expressions --- crates/ra_cli/src/analysis_stats.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_cli') diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs index d355fa2e8..5c0a9dd98 100644 --- a/crates/ra_cli/src/analysis_stats.rs +++ b/crates/ra_cli/src/analysis_stats.rs @@ -110,9 +110,12 @@ pub fn run(verbose: bool, memory_usage: bool, path: &Path, only: Option<&str>) - let original_file = src.file_id.original_file(db); let path = db.file_relative_path(original_file); let line_index = host.analysis().file_line_index(original_file).unwrap(); + let text_range = src + .ast + .either(|it| it.syntax().text_range(), |it| it.syntax().text_range()); let (start, end) = ( - line_index.line_col(src.ast.syntax().text_range().start()), - line_index.line_col(src.ast.syntax().text_range().end()), + line_index.line_col(text_range.start()), + line_index.line_col(text_range.end()), ); bar.println(format!( "{} {}:{}-{}:{}: Expected {}, got {}", -- cgit v1.2.3