1
Fork 0

Improve errors for recursive type aliases

This commit is contained in:
Noah Lev 2021-07-20 18:06:39 -07:00
parent d3e2578c31
commit 2f48bfa88c
14 changed files with 38 additions and 23 deletions

View file

@ -116,7 +116,18 @@ rustc_queries! {
/// Records the type of every item.
query type_of(key: DefId) -> Ty<'tcx> {
desc { |tcx| "computing type of `{}`", tcx.def_path_str(key) }
desc { |tcx|
"{action} `{path}`",
action = {
use rustc_hir::def::DefKind;
match tcx.def_kind(key) {
DefKind::TyAlias => "expanding type alias",
DefKind::TraitAlias => "expanding trait alias",
_ => "computing type of",
}
},
path = tcx.def_path_str(key),
}
cache_on_disk_if { key.is_local() }
}