diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-05-26 14:22:00 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-05-26 14:22:00 +0800 |
commit | 1b8e9e01a8ebce42e8ad3dca101180430b28c947 (patch) | |
tree | 32aba1e96d125ca8057cad2631ee0001fca30721 /src/mir/from_hir.cpp | |
parent | 18476fb8893417176b7ba902eb9556225f96a4f7 (diff) | |
download | mrust-1b8e9e01a8ebce42e8ad3dca101180430b28c947.tar.gz |
HIR Typecheck - Handle struct syntax for unit structs
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r-- | src/mir/from_hir.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index cb9b5771..6b756952 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -2091,6 +2091,14 @@ namespace { BUG(node.span(), "_StructLiteral Union"); ), (Struct, + if(e->m_data.is_Unit()) { + m_builder.set_result( node.span(), ::MIR::RValue::make_Struct({ + node.m_path.clone(), + variant_index, + {} + }) ); + return ; + } fields_ptr = &e->m_data.as_Named(); ) ) |