Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r--crates/hir/src/semantics.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 9d97dc7421..252f4ac7f2 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -36,20 +36,19 @@ use hir_ty::{
diagnostics::unsafe_operations,
infer_query_with_inspect,
next_solver::{
- AnyImplId, DbInterner, Span,
+ AnyImplId, DbInterner,
format_proof_tree::{ProofTreeData, dump_proof_tree_structured},
},
};
use intern::{Interned, Symbol, sym};
use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet};
-use rustc_type_ir::inherent::Span as _;
use smallvec::{SmallVec, smallvec};
use span::{FileId, SyntaxContext};
use stdx::{TupleExt, always};
use syntax::{
- AstNode, AstToken, Direction, SmolStr, SmolStrBuilder, SyntaxElement, SyntaxKind, SyntaxNode,
- SyntaxNodePtr, SyntaxToken, T, TextRange, TextSize,
+ AstNode, AstPtr, AstToken, Direction, SmolStr, SmolStrBuilder, SyntaxElement, SyntaxKind,
+ SyntaxNode, SyntaxNodePtr, SyntaxToken, T, TextRange, TextSize,
algo::skip_trivia_token,
ast::{self, HasAttrs as _, HasGenericParams},
};
@@ -544,6 +543,10 @@ impl<'db> SemanticsImpl<'db> {
node
}
+ pub fn to_node<N: AstNode>(&self, ptr: InFile<AstPtr<N>>) -> N {
+ ptr.value.to_node(&self.parse_or_expand(ptr.file_id))
+ }
+
pub fn expand(&self, file_id: MacroCallId) -> ExpandResult<SyntaxNode> {
let res = self.db.parse_macro_expansion(file_id).map(|it| it.0.syntax_node());
self.cache(res.value.clone(), file_id.into());
@@ -2459,7 +2462,8 @@ impl<'db> SemanticsImpl<'db> {
if result.is_err()
&& let Some(tree) = proof_tree
{
- let data = dump_proof_tree_structured(tree, Span::dummy(), infer_ctxt);
+ let data =
+ dump_proof_tree_structured(tree, hir_ty::Span::Dummy, infer_ctxt);
RESULT.with(|ctx| ctx.borrow_mut().push(data));
}
}),