diff options
| author | Hannah McLaughlin <h@mcla.ug> | 2020-11-15 21:14:00 +0000 |
|---|---|---|
| committer | Hannah McLaughlin <h@mcla.ug> | 2020-11-18 21:20:51 +0000 |
| commit | d38dbcb19f6ef1c5ffcf7869767674ef3d6d045f (patch) | |
| tree | 4981adebb60be32c7874de8cd058d99b4a081686 /compiler | |
| parent | 071d8b14dab01f636aa4c8ec707a59a00bfa356d (diff) | |
| download | rust-d38dbcb19f6ef1c5ffcf7869767674ef3d6d045f.tar.gz rust-d38dbcb19f6ef1c5ffcf7869767674ef3d6d045f.zip | |
Improve error message when we try to get_type on something that does not have a type
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index a1df1a63fc5..19340dd51de 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -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> { |
