summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2018-04-07 00:12:24 -0400
committerTamir Duberstein <tamird@gmail.com>2018-04-08 18:31:45 -0400
commitcd37739d4e7d193301e94d45c7f1448118cbc7fd (patch)
treec777329d3be3b33fe12fc2e8ce204b5917f8b5b0 /src/codegen/mod.rs
parentac3e4e476f67411177e73e80f0e932aaba5a6593 (diff)
TemplateParameters.self_template_params doesn't return Option
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 6483412e..34e87d89 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -3138,18 +3138,16 @@ impl TryToRustTy for TemplateInstantiation {
let def_path = def.namespace_aware_canonical_path(ctx);
ty.append_separated(def_path.into_iter().map(|p| ctx.rust_ident(p)), Term::new("::", Span::call_site()));
- let def_params = match def.self_template_params(ctx) {
- Some(params) => params,
- None => {
- // This can happen if we generated an opaque type for a partial
- // template specialization, and we've hit an instantiation of
- // that partial specialization.
- extra_assert!(
- def.is_opaque(ctx, &())
- );
- return Err(error::Error::InstantiationOfOpaqueType);
- }
- };
+ let def_params = def.self_template_params(ctx);
+ if def_params.is_empty() {
+ // This can happen if we generated an opaque type for a partial
+ // template specialization, and we've hit an instantiation of
+ // that partial specialization.
+ extra_assert!(
+ def.is_opaque(ctx, &())
+ );
+ return Err(error::Error::InstantiationOfOpaqueType);
+ }
// TODO: If the definition type is a template class/struct
// definition's member template definition, it could rely on