Skip to content

Commit 8e4d9b8

Browse files
committed
Auto merge of rust-lang#12886 - Veykril:sema-cache, r=Veykril
fix: Fix Semantics::original_ast_node not caching the resulting file
2 parents c2eebd7 + 6c379b9 commit 8e4d9b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/hir/src/semantics.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,12 @@ impl<'db> SemanticsImpl<'db> {
924924
}
925925

926926
fn original_ast_node<N: AstNode>(&self, node: N) -> Option<N> {
927-
self.wrap_node_infile(node).original_ast_node(self.db.upcast()).map(|it| it.value)
927+
self.wrap_node_infile(node).original_ast_node(self.db.upcast()).map(
928+
|InFile { file_id, value }| {
929+
self.cache(find_root(value.syntax()), file_id);
930+
value
931+
},
932+
)
928933
}
929934

930935
fn diagnostics_display_range(&self, src: InFile<SyntaxNodePtr>) -> FileRange {

0 commit comments

Comments
 (0)