Skip to content

Commit 72ab471

Browse files
committed
Simplify control flow in TemplateInstantiation's ToRustTy
If we hit a case where we generate an opaque blob instead of an instantiation of a generic, then we won't ever be attaching generic parameters, and can bail out of the function early.
1 parent b914a09 commit 72ab471

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/codegen/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2361,7 +2361,7 @@ impl ToRustTy for TemplateInstantiation {
23612361
// instantiation.
23622362
if ty == aster::AstBuilder::new().ty().unit().unwrap() {
23632363
if let Some(layout) = self_ty.layout(ctx) {
2364-
ty = BlobTyBuilder::new(layout).build().unwrap()
2364+
return BlobTyBuilder::new(layout).build();
23652365
}
23662366
}
23672367

@@ -2376,9 +2376,7 @@ impl ToRustTy for TemplateInstantiation {
23762376
debug_assert!(ctx.resolve_type_through_type_refs(decl)
23772377
.is_opaque());
23782378
let layout = self_ty.layout(ctx).unwrap_or(Layout::zero());
2379-
ty = BlobTyBuilder::new(layout).build().unwrap();
2380-
2381-
vec![]
2379+
return BlobTyBuilder::new(layout).build();
23822380
};
23832381

23842382
// TODO: If the decl type is a template class/struct

0 commit comments

Comments
 (0)