use chalk_ir::BoundVar;
use hir_def::{
+ body,
db::DefDatabase,
find_path,
generics::TypeParamProvenance,
visibility::Visibility,
AssocContainerId, Lookup, ModuleId, TraitId,
};
-use hir_expand::name::Name;
+use hir_expand::{hygiene::Hygiene, name::Name};
use crate::{
const_from_placeholder_idx, db::HirDatabase, from_assoc_type_id, from_foreign_def_id,
let param_data = &generics.params.consts[id.local_id];
write!(f, "{}", param_data.name)
}
- ConstValue::Concrete(_) => write!(f, "_"),
+ ConstValue::Concrete(c) => write!(f, "{}", c.interned),
}
}
}
write!(f, "{}", mutability)?;
inner.hir_fmt(f)?;
}
- TypeRef::Array(inner) => {
+ TypeRef::Array(inner, len) => {
write!(f, "[")?;
inner.hir_fmt(f)?;
- // FIXME: Array length?
- write!(f, "; _]")?;
+ write!(f, "; {}]", len)?;
}
TypeRef::Slice(inner) => {
write!(f, "[")?;
write!(f, "dyn ")?;
f.write_joined(bounds, " + ")?;
}
+ TypeRef::Macro(macro_call) => {
+ let macro_call = macro_call.to_node(f.db.upcast());
+ let ctx = body::LowerCtx::with_hygiene(f.db.upcast(), &Hygiene::new_unhygienic());
+ match macro_call.path() {
+ Some(path) => match Path::from_src(path, &ctx) {
+ Some(path) => path.hir_fmt(f)?,
+ None => write!(f, "{{macro}}")?,
+ },
+ None => write!(f, "{{macro}}")?,
+ }
+ write!(f, "!(..)")?;
+ }
TypeRef::Error => write!(f, "{{error}}")?,
}
Ok(())