Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d38dbcb

Browse files
committed
Improve error message when we try to get_type on something that does not have a type
1 parent 071d8b1 commit d38dbcb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,12 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
947947
}
948948

949949
fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
950-
self.root.tables.ty.get(self, id).unwrap().decode((self, tcx))
950+
self.root
951+
.tables
952+
.ty
953+
.get(self, id)
954+
.unwrap_or_else(|| panic!("Not a type: {:?}", id))
955+
.decode((self, tcx))
951956
}
952957

953958
fn get_stability(&self, id: DefIndex) -> Option<attr::Stability> {

0 commit comments

Comments
 (0)