mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-25 11:17:13 +00:00
Merge pull request #20445 from rust-lang/veykril/push-twmmuyzwtxno
fix: Attach db for inlay hint compute
This commit is contained in:
commit
2cc7bb371d
@ -289,7 +289,7 @@ impl<'db> DbInterner<'db> {
|
||||
krate: None,
|
||||
block: None,
|
||||
})
|
||||
.unwrap()
|
||||
.expect("db is expected to be attached")
|
||||
}
|
||||
|
||||
pub fn new_with(
|
||||
|
@ -107,14 +107,16 @@ pub(crate) fn inlay_hints(
|
||||
}
|
||||
};
|
||||
let mut preorder = file.preorder();
|
||||
while let Some(event) = preorder.next() {
|
||||
if matches!((&event, range_limit), (WalkEvent::Enter(node), Some(range)) if range.intersect(node.text_range()).is_none())
|
||||
{
|
||||
preorder.skip_subtree();
|
||||
continue;
|
||||
salsa::attach(sema.db, || {
|
||||
while let Some(event) = preorder.next() {
|
||||
if matches!((&event, range_limit), (WalkEvent::Enter(node), Some(range)) if range.intersect(node.text_range()).is_none())
|
||||
{
|
||||
preorder.skip_subtree();
|
||||
continue;
|
||||
}
|
||||
hints(event);
|
||||
}
|
||||
hints(event);
|
||||
}
|
||||
});
|
||||
if let Some(range_limit) = range_limit {
|
||||
acc.retain(|hint| range_limit.contains_range(hint.range));
|
||||
}
|
||||
@ -736,7 +738,7 @@ fn label_of_ty(
|
||||
config: &InlayHintsConfig,
|
||||
display_target: DisplayTarget,
|
||||
) -> Result<(), HirDisplayError> {
|
||||
let iter_item_type = salsa::attach(sema.db, || hint_iterator(sema, famous_defs, ty));
|
||||
let iter_item_type = hint_iterator(sema, famous_defs, ty);
|
||||
match iter_item_type {
|
||||
Some((iter_trait, item, ty)) => {
|
||||
const LABEL_START: &str = "impl ";
|
||||
|
Loading…
x
Reference in New Issue
Block a user