Skip to content

Subtree update of rust-analyzer #122628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 89 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
5db0494
By tracking import use types to check whether it is scope uses or the…
surechen Nov 10, 2023
1c10aa4
Auto merge of #117772 - surechen:for_117448, r=petrochenkov
bors Feb 18, 2024
e057365
Remove suspicious auto trait lint
spastorino Feb 19, 2024
9e4ecc6
Merge commit '4a8d0f7f565b6df45da5522dd7366a4df3460cd7' into sync-fro…
lnicola Feb 25, 2024
2edd74b
Add missing imports
lnicola Feb 25, 2024
f206d8b
Avoid using cfg(FALSE)
lnicola Feb 25, 2024
80470d5
Merge commit '4ef6a49b44e8aa380da7522442234bfd7a52c55e' into sync-fro…
lnicola Mar 3, 2024
49c0b33
Change message type in bug functions.
nnethercote Feb 21, 2024
593156a
Re-use `InferenceTable` by snapshotting in method resolution
Veykril Mar 4, 2024
d21f888
Remove some unnecessary cloning in method_resolution
Veykril Mar 4, 2024
b45cfe1
Added quickfix for unresolved field.
wyatt-herkamp Mar 5, 2024
6027eae
Fix Tests + Fix Warnings
wyatt-herkamp Mar 5, 2024
255ba69
Added tests, added Union Support, and code cleanup
wyatt-herkamp Mar 6, 2024
4f0bc1a
Typo
wyatt-herkamp Mar 6, 2024
f45b080
Starting Fix for cfg stripping
wyatt-herkamp Mar 8, 2024
02b6c18
Compress file text using lz4 in salsa
lnicola Jan 10, 2024
0f43b55
Stop using an Arc when setting the file text
lnicola Jan 10, 2024
a12ccd5
Fix test
lnicola Mar 8, 2024
79f2651
Add cfg_attr and cleanup code
wyatt-herkamp Mar 9, 2024
948a2de
Clippy Fix
wyatt-herkamp Mar 9, 2024
717ba1d
Clippy fixes
lnicola Feb 14, 2024
aa74d57
Merge commit '574e23ec508064613783cba3d1833a95fd9a5080' into sync-fro…
lnicola Mar 10, 2024
ce64207
Bring back in-rust-tree feature to ide
lnicola Mar 10, 2024
fb9744e
Merge branch 'master' into sync-from-rust3
lnicola Mar 11, 2024
f65fe4e
Fix import
lnicola Mar 11, 2024
0931361
Auto merge of #16807 - lnicola:sync-from-rust3, r=lnicola
bors Mar 11, 2024
558feea
internal: Remove synstructure const hack support
Veykril Mar 8, 2024
458f4a2
internal: Treat the self param as different from patterns when lowering
Veykril Mar 6, 2024
c679482
Add method resolution deref inference var test
Veykril Mar 5, 2024
1069f57
Auto merge of #16784 - Veykril:body-invalid, r=Veykril
bors Mar 11, 2024
a5035f4
Auto merge of #16749 - Veykril:on-demand-validation-err, r=Veykril
bors Mar 11, 2024
57a0ad4
Stop eagerly resolving inlay hint text edits for VSCode
SomeoneToIgnore Jan 10, 2024
0dbaccd
Track vscode version for conditional bug server sided bugfixes
Veykril Mar 11, 2024
a58f574
Auto merge of #16762 - wyatt-herkamp:master, r=Veykril
bors Mar 11, 2024
a0dd822
Auto merge of #16473 - SomeoneToIgnore:kb/remove-resolve-stub, r=Veykril
bors Mar 11, 2024
0fb5d0d
Check for cfg_attr on the actual item and Debug instead of info in cf…
wyatt-herkamp Mar 11, 2024
7713657
feat: add fix for unused_variables
Young-Flash Mar 11, 2024
562f4a2
test: update test for unused_variables
Young-Flash Mar 11, 2024
2320e12
Auto merge of #16771 - Veykril:self-param-split, r=Veykril
bors Mar 11, 2024
40ee359
Auto merge of #16810 - Young-Flash:unused_var_fix, r=Veykril
bors Mar 11, 2024
fc11216
feat: Add proc macro semantic token type
ShoyuVanilla Mar 11, 2024
2f87215
Auto merge of #16808 - ShoyuVanilla:proc-macro-sem-token, r=Veykril
bors Mar 11, 2024
8f8bcfc
Auto merge of #16335 - lnicola:salsa-lz4-file-text, r=Veykril
bors Mar 11, 2024
fdc527f
fix: Fix method resolution snapshotting receiver_ty too early
Veykril Mar 11, 2024
03d2d90
Auto merge of #16811 - Veykril:snapshot, r=Veykril
bors Mar 11, 2024
447de3d
Review Updates and added tests.
wyatt-herkamp Mar 11, 2024
d3e6fea
Auto merge of #16789 - wyatt-herkamp:cfg_attr, r=Veykril
bors Mar 12, 2024
cb6c26b
Don't auto-close block comments in strings
lnicola Mar 12, 2024
9bc1eb4
Auto merge of #16820 - lnicola:no-string-comment-autoclose, r=lnicola
bors Mar 12, 2024
9ba4493
internal: Improve rooted upmapping
Veykril Mar 12, 2024
a2e2741
Auto merge of #16819 - Veykril:span-upmapping, r=Veykril
bors Mar 12, 2024
30d3d68
Fix unwanted leading whitespace in hover text
Wilfred Mar 12, 2024
e8182a5
Auto merge of #16824 - Wilfred:size_whitespace, r=lnicola
bors Mar 13, 2024
87e0bbc
Stronger typing for macro_arg query
Veykril Mar 13, 2024
abe3177
Shrink MacroCallLoc
Veykril Mar 13, 2024
9767156
Simplify
Veykril Mar 13, 2024
9c8a57e
fix: simplify extract_module
roife Mar 13, 2024
4180565
fix: donot generate redundant use stmt for items in selection in extr…
roife Mar 14, 2024
6fc3a3e
Auto merge of #16832 - Veykril:macarons, r=Veykril
bors Mar 14, 2024
02214a6
fix: remove redundant use node insertion
roife Mar 14, 2024
6248b45
fix: do not add use stmt when use stmt is selected in extract_module
roife Mar 14, 2024
d2f8eae
feat: Support macro calls in eager macros for IDE features
Veykril Mar 14, 2024
d085ade
Remove dead test code
Veykril Mar 14, 2024
14558af
Auto merge of #16834 - Veykril:macarons, r=Veykril
bors Mar 14, 2024
5b2809f
fix: simplification on extract_module
roife Mar 14, 2024
c50c4f8
internal: Use assoc items as anchors for spans
Veykril Mar 15, 2024
a9a26c1
Auto merge of #16841 - Veykril:macarons, r=Veykril
bors Mar 15, 2024
3b1ad23
internal: Make def site span for proc-macro more invalidation resistant
Veykril Mar 15, 2024
9029c51
Auto merge of #16842 - Veykril:macarons, r=Veykril
bors Mar 15, 2024
08327e0
Drop eager macro parse errors, they can't crop up
Veykril Mar 15, 2024
b59c8c7
Repalce Span with SyntaxContextId in MacroCallLoc
Veykril Mar 15, 2024
de71605
fix: remove useless loop
roife Mar 15, 2024
0dd89d7
Remove usages of SpanData where Span suffices
Veykril Mar 15, 2024
d763e05
Auto merge of #16844 - Veykril:macarons, r=Veykril
bors Mar 15, 2024
eeff20d
Show compilation progress in test explorer
HKalbasi Mar 15, 2024
513c6d3
fix: re-insert use stmts that is extracted
roife Mar 15, 2024
d40c0fe
test: add test for extract_module
roife Mar 15, 2024
10aa999
fix: typo
roife Mar 15, 2024
f9a4d05
Auto merge of #16845 - HKalbasi:test-explorer, r=HKalbasi
bors Mar 15, 2024
dcfc9cc
Distinguish integration tests from crates in test explorer
HKalbasi Mar 15, 2024
d7ec7a5
Auto merge of #16847 - HKalbasi:test-explorer, r=HKalbasi
bors Mar 15, 2024
bf89762
Build releases on Ubuntu 20.04
lnicola Mar 15, 2024
ee03bd0
Auto merge of #16851 - lnicola:ubuntu-20.04, r=lnicola
bors Mar 16, 2024
64c12e6
Bump follow-redirects from 1.15.4 to 1.15.6 in /editors/code
dependabot[bot] Mar 16, 2024
c8badeb
Auto merge of #16854 - rust-lang:dependabot/npm_and_yarn/editors/code…
bors Mar 16, 2024
d69a81f
fix: Fix wrong where clause rendering on hover
Veykril Mar 16, 2024
b94c285
Auto merge of #16856 - Veykril:macarons, r=Veykril
bors Mar 16, 2024
5ecace4
Auto merge of #16846 - roife:fix-issue16826, r=Veykril
bors Mar 16, 2024
20ecf07
Merge commit '5ecace48f693afaa6adf8cb23086b651db3aec96' into sync-fro…
lnicola Mar 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
internal: Improve rooted upmapping
  • Loading branch information
Veykril committed Mar 12, 2024
commit 9ba4493918c37432d15c2065821c9c29d9d11341
31 changes: 29 additions & 2 deletions crates/hir-def/src/nameres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ use std::ops::Deref;

use base_db::{CrateId, Edition, FileId};
use hir_expand::{
name::Name, proc_macro::ProcMacroKind, HirFileId, InFile, MacroCallId, MacroDefId,
name::Name, proc_macro::ProcMacroKind, ErasedAstId, HirFileId, InFile, MacroCallId, MacroDefId,
};
use itertools::Itertools;
use la_arena::Arena;
use rustc_hash::{FxHashMap, FxHashSet};
use span::FileAstId;
use span::{FileAstId, ROOT_ERASED_FILE_AST_ID};
use stdx::format_to;
use syntax::{ast, SmolStr};
use triomphe::Arc;
use tt::TextRange;

use crate::{
db::DefDatabase,
Expand Down Expand Up @@ -677,13 +678,39 @@ impl ModuleData {
}
}

pub fn definition_source_range(&self, db: &dyn DefDatabase) -> InFile<TextRange> {
match &self.origin {
&ModuleOrigin::File { definition, .. } | &ModuleOrigin::CrateRoot { definition } => {
InFile::new(
definition.into(),
ErasedAstId::new(definition.into(), ROOT_ERASED_FILE_AST_ID)
.to_range(db.upcast()),
)
}
&ModuleOrigin::Inline { definition, definition_tree_id } => InFile::new(
definition_tree_id.file_id(),
AstId::new(definition_tree_id.file_id(), definition).to_range(db.upcast()),
),
ModuleOrigin::BlockExpr { block, .. } => {
InFile::new(block.file_id, block.to_range(db.upcast()))
}
}
}

/// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
/// `None` for the crate root or block.
pub fn declaration_source(&self, db: &dyn DefDatabase) -> Option<InFile<ast::Module>> {
let decl = self.origin.declaration()?;
let value = decl.to_node(db.upcast());
Some(InFile { file_id: decl.file_id, value })
}

/// Returns the range which declares this module, either a `mod foo;` or a `mod foo {}`.
/// `None` for the crate root or block.
pub fn declaration_source_range(&self, db: &dyn DefDatabase) -> Option<InFile<TextRange>> {
let decl = self.origin.declaration()?;
Some(InFile { file_id: decl.file_id, value: decl.to_range(db.upcast()) })
}
}

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
113 changes: 44 additions & 69 deletions crates/hir-expand/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use syntax::{AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange,

use crate::{
db::{self, ExpandDatabase},
map_node_range_up, span_for_offset, MacroFileIdExt,
map_node_range_up, map_node_range_up_rooted, span_for_offset, MacroFileIdExt,
};

/// `InFile<T>` stores a value of `T` inside a particular file/syntax tree.
Expand Down Expand Up @@ -38,6 +38,9 @@ impl<N: AstIdNode> AstId<N> {
pub fn to_node(&self, db: &dyn ExpandDatabase) -> N {
self.to_ptr(db).to_node(&db.parse_or_expand(self.file_id))
}
pub fn to_range(&self, db: &dyn ExpandDatabase) -> TextRange {
self.to_ptr(db).text_range()
}
pub fn to_in_file_node(&self, db: &dyn ExpandDatabase) -> crate::InFile<N> {
crate::InFile::new(self.file_id, self.to_ptr(db).to_node(&db.parse_or_expand(self.file_id)))
}
Expand All @@ -49,6 +52,9 @@ impl<N: AstIdNode> AstId<N> {
pub type ErasedAstId = crate::InFile<ErasedFileAstId>;

impl ErasedAstId {
pub fn to_range(&self, db: &dyn ExpandDatabase) -> TextRange {
self.to_ptr(db).text_range()
}
pub fn to_ptr(&self, db: &dyn ExpandDatabase) -> SyntaxNodePtr {
db.ast_id_map(self.file_id).get_erased(self.value)
}
Expand Down Expand Up @@ -173,66 +179,27 @@ impl InFile<&SyntaxNode> {
///
/// For attributes and derives, this will point back to the attribute only.
/// For the entire item use [`InFile::original_file_range_full`].
pub fn original_file_range(self, db: &dyn db::ExpandDatabase) -> FileRange {
match self.file_id.repr() {
HirFileIdRepr::FileId(file_id) => FileRange { file_id, range: self.value.text_range() },
HirFileIdRepr::MacroFile(mac_file) => {
if let Some((res, ctxt)) =
map_node_range_up(db, &db.expansion_span_map(mac_file), self.value.text_range())
{
// FIXME: Figure out an API that makes proper use of ctx, this only exists to
// keep pre-token map rewrite behaviour.
if ctxt.is_root() {
return res;
}
}
// Fall back to whole macro call.
let loc = db.lookup_intern_macro_call(mac_file.macro_call_id);
loc.kind.original_call_range(db)
}
}
pub fn original_file_range_rooted(self, db: &dyn db::ExpandDatabase) -> FileRange {
self.map(SyntaxNode::text_range).original_node_file_range_rooted(db)
}

/// Falls back to the macro call range if the node cannot be mapped up fully.
pub fn original_file_range_with_macro_call_body(
self,
db: &dyn db::ExpandDatabase,
) -> FileRange {
match self.file_id.repr() {
HirFileIdRepr::FileId(file_id) => FileRange { file_id, range: self.value.text_range() },
HirFileIdRepr::MacroFile(mac_file) => {
if let Some((res, ctxt)) =
map_node_range_up(db, &db.expansion_span_map(mac_file), self.value.text_range())
{
// FIXME: Figure out an API that makes proper use of ctx, this only exists to
// keep pre-token map rewrite behaviour.
if ctxt.is_root() {
return res;
}
}
// Fall back to whole macro call.
let loc = db.lookup_intern_macro_call(mac_file.macro_call_id);
loc.kind.original_call_range_with_body(db)
}
}
self.map(SyntaxNode::text_range).original_node_file_range_with_macro_call_body(db)
}

/// Attempts to map the syntax node back up its macro calls.
pub fn original_file_range_opt(
self,
db: &dyn db::ExpandDatabase,
) -> Option<(FileRange, SyntaxContextId)> {
match self.file_id.repr() {
HirFileIdRepr::FileId(file_id) => {
Some((FileRange { file_id, range: self.value.text_range() }, SyntaxContextId::ROOT))
}
HirFileIdRepr::MacroFile(mac_file) => {
map_node_range_up(db, &db.expansion_span_map(mac_file), self.value.text_range())
}
}
self.map(SyntaxNode::text_range).original_node_file_range_opt(db)
}

pub fn original_syntax_node(
pub fn original_syntax_node_rooted(
self,
db: &dyn db::ExpandDatabase,
) -> Option<InRealFile<SyntaxNode>> {
Expand All @@ -242,25 +209,21 @@ impl InFile<&SyntaxNode> {
HirFileIdRepr::FileId(file_id) => {
return Some(InRealFile { file_id, value: self.value.clone() })
}
HirFileIdRepr::MacroFile(m) => m,
HirFileIdRepr::MacroFile(m) if m.is_attr_macro(db) => m,
_ => return None,
};
if !file_id.is_attr_macro(db) {
return None;
}

let (FileRange { file_id, range }, ctx) =
map_node_range_up(db, &db.expansion_span_map(file_id), self.value.text_range())?;
let FileRange { file_id, range } =
map_node_range_up_rooted(db, &db.expansion_span_map(file_id), self.value.text_range())?;

// FIXME: Figure out an API that makes proper use of ctx, this only exists to
// keep pre-token map rewrite behavior.
if !ctx.is_root() {
return None;
}

let anc = db.parse(file_id).syntax_node().covering_element(range);
let kind = self.value.kind();
// FIXME: This heuristic is brittle and with the right macro may select completely unrelated nodes?
let value = anc.ancestors().find(|it| it.kind() == kind)?;
let value = db
.parse(file_id)
.syntax_node()
.covering_element(range)
.ancestors()
.take_while(|it| it.text_range() == range)
.find(|it| it.kind() == kind)?;
Some(InRealFile::new(file_id, value))
}
}
Expand Down Expand Up @@ -355,8 +318,8 @@ impl InFile<TextRange> {
match self.file_id.repr() {
HirFileIdRepr::FileId(file_id) => FileRange { file_id, range: self.value },
HirFileIdRepr::MacroFile(mac_file) => {
match map_node_range_up(db, &db.expansion_span_map(mac_file), self.value) {
Some((it, SyntaxContextId::ROOT)) => it,
match map_node_range_up_rooted(db, &db.expansion_span_map(mac_file), self.value) {
Some(it) => it,
_ => {
let loc = db.lookup_intern_macro_call(mac_file.macro_call_id);
loc.kind.original_call_range(db)
Expand All @@ -366,6 +329,24 @@ impl InFile<TextRange> {
}
}

pub fn original_node_file_range_with_macro_call_body(
self,
db: &dyn db::ExpandDatabase,
) -> FileRange {
match self.file_id.repr() {
HirFileIdRepr::FileId(file_id) => FileRange { file_id, range: self.value },
HirFileIdRepr::MacroFile(mac_file) => {
match map_node_range_up_rooted(db, &db.expansion_span_map(mac_file), self.value) {
Some(it) => it,
_ => {
let loc = db.lookup_intern_macro_call(mac_file.macro_call_id);
loc.kind.original_call_range_with_body(db)
}
}
}
}
}

pub fn original_node_file_range_opt(
self,
db: &dyn db::ExpandDatabase,
Expand Down Expand Up @@ -395,18 +376,12 @@ impl<N: AstNode> InFile<N> {
return None;
}

let (FileRange { file_id, range }, ctx) = map_node_range_up(
let FileRange { file_id, range } = map_node_range_up_rooted(
db,
&db.expansion_span_map(file_id),
self.value.syntax().text_range(),
)?;

// FIXME: Figure out an API that makes proper use of ctx, this only exists to
// keep pre-token map rewrite behaviour.
if !ctx.is_root() {
return None;
}

// FIXME: This heuristic is brittle and with the right macro may select completely unrelated nodes?
let anc = db.parse(file_id).syntax_node().covering_element(range);
let value = anc.ancestors().find_map(N::cast)?;
Expand Down
57 changes: 56 additions & 1 deletion crates/hir-expand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ pub mod span_map;
mod fixup;

use attrs::collect_attrs;
use rustc_hash::FxHashMap;
use triomphe::Arc;

use std::{fmt, hash::Hash};

use base_db::{salsa::impl_intern_value_trivial, CrateId, Edition, FileId};
use either::Either;
use span::{ErasedFileAstId, FileRange, HirFileIdRepr, Span, SyntaxContextData, SyntaxContextId};
use span::{
ErasedFileAstId, FileRange, HirFileIdRepr, Span, SpanAnchor, SyntaxContextData, SyntaxContextId,
};
use syntax::{
ast::{self, AstNode},
SyntaxNode, SyntaxToken, TextRange, TextSize,
Expand Down Expand Up @@ -683,6 +686,8 @@ impl ExpansionInfo {
}

/// Maps the passed in file range down into a macro expansion if it is the input to a macro call.
///
/// Note this does a linear search through the entire backing vector of the spanmap.
pub fn map_range_down(
&self,
span: Span,
Expand Down Expand Up @@ -793,7 +798,34 @@ impl ExpansionInfo {
}
}

/// Maps up the text range out of the expansion hierarchy back into the original file its from only
/// considering the root spans contained.
/// Unlike [`map_node_range_up`], this will not return `None` if any anchors or syntax contexts differ.
pub fn map_node_range_up_rooted(
db: &dyn ExpandDatabase,
exp_map: &ExpansionSpanMap,
range: TextRange,
) -> Option<FileRange> {
let mut spans = exp_map.spans_for_range(range).filter(|span| span.ctx.is_root());
let Span { range, anchor, ctx: _ } = spans.next()?;
let mut start = range.start();
let mut end = range.end();

for span in spans {
if span.anchor != anchor {
return None;
}
start = start.min(span.range.start());
end = end.max(span.range.end());
}
let anchor_offset =
db.ast_id_map(anchor.file_id.into()).get_erased(anchor.ast_id).text_range().start();
Some(FileRange { file_id: anchor.file_id, range: TextRange::new(start, end) + anchor_offset })
}

/// Maps up the text range out of the expansion hierarchy back into the original file its from.
///
/// this will return `None` if any anchors or syntax contexts differ.
pub fn map_node_range_up(
db: &dyn ExpandDatabase,
exp_map: &ExpansionSpanMap,
Expand All @@ -819,6 +851,29 @@ pub fn map_node_range_up(
))
}

/// Maps up the text range out of the expansion hierarchy back into the original file its from.
/// This version will aggregate the ranges of all spans with the same anchor and syntax context.
pub fn map_node_range_up_aggregated(
db: &dyn ExpandDatabase,
exp_map: &ExpansionSpanMap,
range: TextRange,
) -> FxHashMap<(SpanAnchor, SyntaxContextId), TextRange> {
let mut map = FxHashMap::default();
for span in exp_map.spans_for_range(range) {
let range = map.entry((span.anchor, span.ctx)).or_insert_with(|| span.range);
*range = TextRange::new(
range.start().min(span.range.start()),
range.end().max(span.range.end()),
);
}
for ((anchor, _), range) in &mut map {
let anchor_offset =
db.ast_id_map(anchor.file_id.into()).get_erased(anchor.ast_id).text_range().start();
*range += anchor_offset;
}
map
}

/// Looks up the span at the given offset.
pub fn span_for_offset(
db: &dyn ExpandDatabase,
Expand Down
4 changes: 2 additions & 2 deletions crates/hir-expand/src/span_map.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! Span maps for real files and macro expansions.
use span::{FileId, HirFileId, HirFileIdRepr, MacroFileId, Span};
use span::{FileId, HirFileId, HirFileIdRepr, MacroFileId, Span, SyntaxContextId};
use syntax::{AstNode, TextRange};
use triomphe::Arc;

pub use span::RealSpanMap;

use crate::db::ExpandDatabase;

pub type ExpansionSpanMap = span::SpanMap<Span>;
pub type ExpansionSpanMap = span::SpanMap<SyntaxContextId>;

/// Spanmap for a macro file or a real file
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
6 changes: 3 additions & 3 deletions crates/hir-ty/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_sour
Some(value) => value,
None => continue,
};
let range = node.as_ref().original_file_range(&db);
let range = node.as_ref().original_file_range_rooted(&db);
if let Some(expected) = types.remove(&range) {
let actual = if display_source {
ty.display_source_code(&db, def.module(&db), true).unwrap()
Expand All @@ -180,7 +180,7 @@ fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_sour
Some(value) => value,
None => continue,
};
let range = node.as_ref().original_file_range(&db);
let range = node.as_ref().original_file_range_rooted(&db);
if let Some(expected) = types.remove(&range) {
let actual = if display_source {
ty.display_source_code(&db, def.module(&db), true).unwrap()
Expand Down Expand Up @@ -211,7 +211,7 @@ fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_sour
}) else {
continue;
};
let range = node.as_ref().original_file_range(&db);
let range = node.as_ref().original_file_range_rooted(&db);
let actual = format!(
"expected {}, got {}",
mismatch.expected.display_test(&db),
Expand Down
Loading