Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/pretty.rs')
-rw-r--r--crates/hir-ty/src/mir/pretty.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/hir-ty/src/mir/pretty.rs b/crates/hir-ty/src/mir/pretty.rs
index 366c2f662b..23fc271355 100644
--- a/crates/hir-ty/src/mir/pretty.rs
+++ b/crates/hir-ty/src/mir/pretty.rs
@@ -7,7 +7,7 @@ use std::{
use either::Either;
use hir_def::{body::Body, hir::BindingId};
-use hir_expand::name::Name;
+use hir_expand::{name::Name, Lookup};
use la_arena::ArenaMap;
use crate::{
@@ -58,8 +58,14 @@ impl MirBody {
);
}
hir_def::DefWithBodyId::VariantId(id) => {
- let data = db.enum_data(id.parent);
- w!(this, "enum {} = ", data.name.display(db.upcast()));
+ let loc = id.lookup(db.upcast());
+ let enum_loc = loc.parent.lookup(db.upcast());
+ w!(
+ this,
+ "enum {}::{} = ",
+ enum_loc.id.item_tree(db.upcast())[enum_loc.id.value].name.display(db.upcast()),
+ loc.id.item_tree(db.upcast())[loc.id.value].name.display(db.upcast()),
+ )
}
hir_def::DefWithBodyId::InTypeConstId(id) => {
w!(this, "in type const {id:?} = ");
@@ -306,8 +312,7 @@ impl<'a> MirPrettyCtx<'a> {
hir_def::VariantId::EnumVariantId(e) => {
w!(this, "(");
f(this, local, head);
- let variant_name =
- &this.db.enum_data(e.parent).variants[e.local_id].name;
+ let variant_name = &this.db.enum_variant_data(e).name;
w!(
this,
" as {}).{}",
@@ -339,7 +344,7 @@ impl<'a> MirPrettyCtx<'a> {
}
}
}
- f(self, p.local, &p.projection.lookup(&self.body.projection_store));
+ f(self, p.local, p.projection.lookup(&self.body.projection_store));
}
fn operand(&mut self, r: &Operand) {