summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-04-04 13:48:34 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2017-04-04 14:24:00 -0700
commit5e38020b84d300b68befa65f73f0335bcd2fdca0 (patch)
tree0484a7c79f9afd59db91f3f54a72f0f3ac17bb8c
parente51789aab7005bbc27c27bc8700f9244cff10ce0 (diff)
Generalize fallibility template instantiation fallibility
Return `None` whenever we can't find a template definition, not only when the template is a builtin.
-rw-r--r--src/ir/template.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ir/template.rs b/src/ir/template.rs
index 4022b366..18a3f805 100644
--- a/src/ir/template.rs
+++ b/src/ir/template.rs
@@ -100,10 +100,6 @@ impl TemplateInstantiation {
.collect()
});
- if ty.declaration().is_builtin() {
- return None;
- }
-
let definition = ty.declaration()
.specialized()
.or_else(|| {
@@ -122,8 +118,12 @@ impl TemplateInstantiation {
});
template_ref.and_then(|cur| cur.referenced())
- })
- .expect("Should have found the template definition one way or another");
+ });
+
+ let definition = match definition {
+ None => return None,
+ Some(def) => def,
+ };
let template_definition =
Item::from_ty_or_ref(definition.cur_type(), definition, None, ctx);