From 306c6cbaac692bd5fec66173cb7fd9f2d7de9e98 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 8 Dec 2020 19:03:24 +0100 Subject: Use `original_file_range` in `TestDB` --- crates/hir_def/src/test_db.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/hir_def/src/test_db.rs b/crates/hir_def/src/test_db.rs index 59c788b18..f8b150850 100644 --- a/crates/hir_def/src/test_db.rs +++ b/crates/hir_def/src/test_db.rs @@ -158,17 +158,11 @@ impl TestDB { let src = d.display_source(); let root = db.parse_or_expand(src.file_id).unwrap(); - // Place all diagnostics emitted in macro files on the original caller. - // Note that this does *not* match IDE behavior. - let mut src = src.map(|ptr| ptr.to_node(&root)); - while let Some(exp) = src.file_id.call_node(db) { - src = exp; - } + let node = src.map(|ptr| ptr.to_node(&root)); + let frange = node.as_ref().original_file_range(db); - let file_id = src.file_id.original_file(db); - let range = src.value.text_range(); let message = d.message().to_owned(); - actual.entry(file_id).or_default().push((range, message)); + actual.entry(frange.file_id).or_default().push((frange.range, message)); }); for (file_id, diags) in actual.iter_mut() { -- cgit v1.2.3