diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-03-09 14:41:30 -0800 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-03-09 14:41:30 -0800 |
commit | 5bda3aa54f7016d408e5b0c418c5cf9fa1f70125 (patch) | |
tree | 4786a942db0a9ad4fa3f9f781170c1e031df3790 | |
parent | b662443c1bf0c6c0103b91aec30e6b95ea5c4ff4 (diff) |
Add a comment documenting the hacky test of `()` from ToRustTy
-rw-r--r-- | src/codegen/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index fe93783f..3024a819 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -562,6 +562,12 @@ impl CodeGenerator for Type { BlobTyBuilder::new(layout).build() } else { let inner_rust_ty = inner_item.to_rust_ty(ctx); + + // We get a unit if the inner type is a template definition + // that is opaque or has non-type template parameters and + // doesn't know its layout. Its possible that we have better + // information about the layout, and in the worst case, just + // make sure we don't return a zero-sized type. if inner_rust_ty == aster::AstBuilder::new().ty().unit() { let layout = self.layout(ctx).unwrap_or_else(|| Layout::for_size(1)); BlobTyBuilder::new(layout).build() |