Skip to content

Commit

Permalink
Improve error message when we try to get_type on something that does …
Browse files Browse the repository at this point in the history
…not have a type
  • Loading branch information
lochsh committed Nov 18, 2020
1 parent 071d8b1 commit d38dbcb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,12 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

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> {
Expand Down

0 comments on commit d38dbcb

Please sign in to comment.