diff options
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r-- | src/mir/from_hir.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 586a152e..7ead584c 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -777,7 +777,19 @@ namespace { BUG(node.span(), "Invalid cast to " << ty_out); ), (Pointer, - if( ty_in.m_data.is_Primitive() && ty_in.m_data.as_Primitive() == ::HIR::CoreType::Usize ) { + if( ty_in.m_data.is_Primitive() ) { + const auto& ie = ty_in.m_data.as_Primitive(); + switch(ie) + { + case ::HIR::CoreType::Bool: + case ::HIR::CoreType::Char: + case ::HIR::CoreType::Str: + case ::HIR::CoreType::F32: + case ::HIR::CoreType::F64: + BUG(node.span(), "Cannot cast to pointer from " << ty_in); + default: + break; + } // TODO: Only valid if T: Sized in *{const/mut/move} T } else TU_IFLET( ::HIR::TypeRef::Data, ty_in.m_data, Borrow, se, |