Merge pull request #20506 from Veykril/veykril/push-xlytslrrylzq
Some checks failed
rustdoc / rustdoc (push) Has been cancelled
metrics / build_metrics (push) Has been cancelled
metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
metrics / other_metrics (self) (push) Has been cancelled
metrics / other_metrics (webrender-2022) (push) Has been cancelled
metrics / generate_final_metrics (push) Has been cancelled

Fix panic in syntax_highlighting
This commit is contained in:
Shoyu Vanilla (Flint) 2025-08-22 08:14:02 +00:00 committed by GitHub
commit e6cd085099
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 28 deletions

View file

@ -452,10 +452,10 @@ fn traverse(
}
hl
}
NodeOrToken::Token(token) => {
NodeOrToken::Token(token) => salsa::attach(sema.db, || {
highlight::token(sema, token, edition, &is_unsafe_node, tt_level > 0)
.zip(Some(None))
}
}),
};
if let Some((mut highlight, binding_hash)) = element {
if is_unlinked && highlight.tag == HlTag::UnresolvedReference {

View file

@ -5,7 +5,7 @@ use std::mem;
use either::Either;
use hir::{EditionedFileId, HirFileId, InFile, Semantics, sym};
use ide_db::{
SymbolKind, active_parameter::ActiveParameter, defs::Definition,
SymbolKind, active_parameter::ActiveParameter, base_db::salsa, defs::Definition,
documentation::docs_with_rangemap, rust_doc::is_rust_fence,
};
use syntax::{
@ -126,6 +126,7 @@ pub(super) fn doc_comment(
// Extract intra-doc links and emit highlights for them.
if let Some((docs, doc_mapping)) = docs_with_rangemap(sema.db, &attributes) {
salsa::attach(sema.db, || {
extract_definitions_from_docs(&docs)
.into_iter()
.filter_map(|(range, link, ns)| {
@ -151,6 +152,7 @@ pub(super) fn doc_comment(
| HlMod::IntraDocLink,
binding_hash: None,
})
})
});
}