Improve error message when we try to get_type on something that does not have a type

This commit is contained in:
Hannah McLaughlin 2020-11-15 21:14:00 +00:00
parent 071d8b14da
commit d38dbcb19f

View file

@ -947,7 +947,12 @@ fn get_generics(&self, item_id: DefIndex, sess: &Session) -> ty::Generics {
}
fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
self.root.tables.ty.get(self, id).unwrap().decode((self, tcx))
self.root
.tables
.ty
.get(self, id)
.unwrap_or_else(|| panic!("Not a type: {:?}", id))
.decode((self, tcx))
}
fn get_stability(&self, id: DefIndex) -> Option<attr::Stability> {