Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/files.rs')
-rw-r--r--crates/hir-expand/src/files.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/hir-expand/src/files.rs b/crates/hir-expand/src/files.rs
index 8c04d05402..13ddb0d4ac 100644
--- a/crates/hir-expand/src/files.rs
+++ b/crates/hir-expand/src/files.rs
@@ -380,14 +380,14 @@ impl InFile<TextRange> {
) -> (FileRange, SyntaxContextId) {
match self.file_id.repr() {
HirFileIdRepr::FileId(file_id) => {
- (FileRange { file_id, range: self.value }, SyntaxContextId::ROOT)
+ (FileRange { file_id, range: self.value }, SyntaxContextId::root(file_id.edition()))
}
HirFileIdRepr::MacroFile(mac_file) => {
match map_node_range_up(db, &db.expansion_span_map(mac_file), self.value) {
Some(it) => it,
None => {
let loc = db.lookup_intern_macro_call(mac_file.macro_call_id);
- (loc.kind.original_call_range(db), SyntaxContextId::ROOT)
+ (loc.kind.original_call_range(db), SyntaxContextId::root(loc.def.edition))
}
}
}
@@ -432,9 +432,10 @@ impl InFile<TextRange> {
db: &dyn db::ExpandDatabase,
) -> Option<(FileRange, SyntaxContextId)> {
match self.file_id.repr() {
- HirFileIdRepr::FileId(file_id) => {
- Some((FileRange { file_id, range: self.value }, SyntaxContextId::ROOT))
- }
+ HirFileIdRepr::FileId(file_id) => Some((
+ FileRange { file_id, range: self.value },
+ SyntaxContextId::root(file_id.edition()),
+ )),
HirFileIdRepr::MacroFile(mac_file) => {
map_node_range_up(db, &db.expansion_span_map(mac_file), self.value)
}