diff options
author | David Tolnay <dtolnay@gmail.com> | 2021-03-28 04:04:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-28 04:04:01 -0400 |
commit | e59625a9d4f6054c5be3e0dacd811e035941aa6d (patch) | |
tree | dc5006121a83d1f8b8411af062a1e46565821647 | |
parent | 457b9f34b316fd38ed8134494a3a9fdc44642df0 (diff) | |
parent | 5f5602c2e5142b976fe4325dacef72cdcc42028a (diff) | |
download | cxx-e59625a9d4f6054c5be3e0dacd811e035941aa6d.tar.gz |
Merge pull request #792 from dtolnay/resolve
Print type name in type resolver error
-rw-r--r-- | syntax/resolve.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/syntax/resolve.rs b/syntax/resolve.rs index 821f5427..757b78f4 100644 --- a/syntax/resolve.rs +++ b/syntax/resolve.rs @@ -10,10 +10,11 @@ pub struct Resolution<'a> { impl<'a> Types<'a> { pub fn resolve(&self, ident: &impl UnresolvedName) -> Resolution<'a> { - *self - .resolutions - .get(ident.ident()) - .expect("Unable to resolve type") + let ident = ident.ident(); + match self.resolutions.get(ident) { + Some(resolution) => *resolution, + None => panic!("Unable to resolve type `{}`", ident), + } } } |