diff options
Diffstat (limited to 'src/mir')
-rw-r--r-- | src/mir/check.cpp | 13 | ||||
-rw-r--r-- | src/mir/from_hir.cpp | 13 | ||||
-rw-r--r-- | src/mir/from_hir.hpp | 1 | ||||
-rw-r--r-- | src/mir/helpers.hpp | 6 | ||||
-rw-r--r-- | src/mir/mir.hpp | 2 |
5 files changed, 18 insertions, 17 deletions
diff --git a/src/mir/check.cpp b/src/mir/check.cpp index 54b831df..4b9dfd8b 100644 --- a/src/mir/check.cpp +++ b/src/mir/check.cpp @@ -689,7 +689,7 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path // TODO: Check suitability of source type (COMPLEX) ), (BinOp, - #if 0 + /* ::HIR::TypeRef tmp_l, tmp_r; const auto& ty_l = state.get_lvalue_type(tmp_l, e.val_l); const auto& ty_r = state.get_lvalue_type(tmp_r, e.val_r); @@ -704,7 +704,7 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path if( ty_l != ty_r ) MIR_BUG(state, "Type mismatch in binop, " << ty_l << " != " << ty_r); } - #endif + */ // TODO: Check return type ), (UniOp, @@ -721,8 +721,9 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path ity_p = &*ty.m_data.as_Borrow().inner; else if( ty.m_data.is_Pointer() ) ity_p = &*ty.m_data.as_Pointer().inner; - else + else { MIR_BUG(state, "DstMeta requires a &-ptr as input, got " << ty); + } const auto& ity = *ity_p; if( ity.m_data.is_Generic() ) ; @@ -754,8 +755,9 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path ity_p = &*ty.m_data.as_Borrow().inner; else if( ty.m_data.is_Pointer() ) ity_p = &*ty.m_data.as_Pointer().inner; - else + else { MIR_BUG(state, "DstPtr requires a &-ptr as input, got " << ty); + } const auto& ity = *ity_p; if( ity.m_data.is_Slice() ) ; @@ -781,8 +783,9 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path ity_p = &*te->inner; else if( const auto* te = ty.m_data.opt_Pointer() ) ity_p = &*te->inner; - else + else { MIR_BUG(state, "DstMeta requires a pointer as output, got " << ty); + } assert(ity_p); auto meta = get_metadata_type(state, *ity_p); if( meta == ::HIR::TypeRef() ) diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 99ffd305..ceda0a87 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -961,19 +961,16 @@ namespace { case _(Sub): op = ::MIR::eBinOp::SUB; if(0) case _(Mul): op = ::MIR::eBinOp::MUL; if(0) case _(Div): op = ::MIR::eBinOp::DIV; if(0) - case _(Mod): op = ::MIR::eBinOp::MOD; if(0) - ; + case _(Mod): op = ::MIR::eBinOp::MOD; this->generate_checked_binop(sp, mv$(dst), op, mv$(dst_clone), ty_slot, mv$(val_p), ty_val); break; case _(Xor): op = ::MIR::eBinOp::BIT_XOR; if(0) case _(Or ): op = ::MIR::eBinOp::BIT_OR ; if(0) - case _(And): op = ::MIR::eBinOp::BIT_AND; if(0) - ; + case _(And): op = ::MIR::eBinOp::BIT_AND; this->generate_checked_binop(sp, mv$(dst), op, mv$(dst_clone), ty_slot, mv$(val_p), ty_val); break; case _(Shl): op = ::MIR::eBinOp::BIT_SHL; if(0) - case _(Shr): op = ::MIR::eBinOp::BIT_SHR; if(0) - ; + case _(Shr): op = ::MIR::eBinOp::BIT_SHR; this->generate_checked_binop(sp, mv$(dst), op, mv$(dst_clone), ty_slot, mv$(val_p), ty_val); break; } @@ -1950,7 +1947,7 @@ namespace { (Function, // TODO: Why not use the result type? //auto monomorph_cb = monomorphise_type_get_cb(sp, nullptr, nullptr, &pe.m_params); - auto monomorph_cb = [&](const auto& gt)->const auto& { + auto monomorph_cb = [&](const auto& gt)->const ::HIR::TypeRef& { const auto& e = gt.m_data.as_Generic(); if( e.binding == 0xFFFF ) { BUG(sp, "Reference to Self in free function - " << gt); @@ -2016,7 +2013,7 @@ namespace { ), (UfcsInherent, // 1. Find item in an impl block - auto rv = m_builder.crate().find_type_impls(*pe.type, [&](const auto& ty)->const auto& { return ty; }, + auto rv = m_builder.crate().find_type_impls(*pe.type, [&](const auto& ty)->const ::HIR::TypeRef& { return ty; }, [&](const auto& impl) { DEBUG("- impl" << impl.m_params.fmt_args() << " " << impl.m_type); // Associated functions diff --git a/src/mir/from_hir.hpp b/src/mir/from_hir.hpp index 291fbe7f..6b10d5bd 100644 --- a/src/mir/from_hir.hpp +++ b/src/mir/from_hir.hpp @@ -56,6 +56,7 @@ TAGGED_UNION_EX(VarState, (), Invalid, ( // Partially valid (Map of field states) (Partial, struct { ::std::vector<VarState> inner_states; + unsigned int outer_flag; // If ~0u there's no condition on the outer }), (MovedOut, struct { ::std::unique_ptr<VarState> inner_state; diff --git a/src/mir/helpers.hpp b/src/mir/helpers.hpp index d7aefe25..802ce88f 100644 --- a/src/mir/helpers.hpp +++ b/src/mir/helpers.hpp @@ -13,8 +13,8 @@ namespace HIR { class Crate; class TypeRef; -class Pattern; -class SimplePath; +struct Pattern; +struct SimplePath; } namespace MIR { @@ -22,7 +22,7 @@ namespace MIR { class Function; class LValue; class Constant; -class BasicBlock; +struct BasicBlock; class Terminator; class Statement; class RValue; diff --git a/src/mir/mir.hpp b/src/mir/mir.hpp index dc33d673..c22f8d5d 100644 --- a/src/mir/mir.hpp +++ b/src/mir/mir.hpp @@ -265,7 +265,7 @@ TAGGED_UNION(Statement, Assign, (SetDropFlag, struct { unsigned int idx; bool new_val; // If `other` is populated, this indicates that the other value should be negated - unsigned int other = ~0u; + unsigned int other; }), // Drop a value (Drop, struct { |