Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/view_memory_layout.rs')
-rw-r--r--crates/ide/src/view_memory_layout.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ide/src/view_memory_layout.rs b/crates/ide/src/view_memory_layout.rs
index 63701a4d15..1eb0fd4fd8 100644
--- a/crates/ide/src/view_memory_layout.rs
+++ b/crates/ide/src/view_memory_layout.rs
@@ -3,6 +3,7 @@ use std::fmt;
use hir::{DisplayTarget, Field, HirDisplay, Layout, Semantics, Type};
use ide_db::{
RootDatabase,
+ base_db::salsa,
defs::Definition,
helpers::{get_definition, pick_best_token},
};
@@ -141,7 +142,9 @@ pub(crate) fn view_memory_layout(
if let Ok(child_layout) = child_ty.layout(db) {
nodes.push(MemoryLayoutNode {
item_name: field.name(db),
- typename: child_ty.display(db, display_target).to_string(),
+ typename: salsa::attach(db, || {
+ child_ty.display(db, display_target).to_string()
+ }),
size: child_layout.size(),
alignment: child_layout.align(),
offset: match *field {
@@ -175,7 +178,7 @@ pub(crate) fn view_memory_layout(
}
}
- ty.layout(db)
+ salsa::attach(db, || ty.layout(db))
.map(|layout| {
let item_name = match def {
// def is a datatype
@@ -188,7 +191,7 @@ pub(crate) fn view_memory_layout(
def => def.name(db).map(|n| n.as_str().to_owned()).unwrap_or("[ROOT]".to_owned()),
};
- let typename = ty.display(db, display_target).to_string();
+ let typename = salsa::attach(db, || ty.display(db, display_target).to_string());
let mut nodes = vec![MemoryLayoutNode {
item_name,