summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-07-21 12:15:42 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-07-21 12:15:42 +0800
commit0a45ac7c93e4e8584fef15b6f2896528a9dbffdd (patch)
treef2ca96a28099623c59d228c446e359027ad6dabb
parent9b419ffea75dabd4f5c870031ac003b6d2abecf8 (diff)
downloadmrust-0a45ac7c93e4e8584fef15b6f2896528a9dbffdd.tar.gz
HIR - Partial support for large arrays (may fail downstream with overflows)
-rw-r--r--src/hir/from_ast.cpp4
-rw-r--r--src/hir/type.hpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index 0ce55478..dde40e03 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -752,8 +752,8 @@ HIR::LifetimeRef LowerHIR_LifetimeRef(const ::AST::LifetimeRef& r)
if( ptr->m_datatype == CORETYPE_UINT || ptr->m_datatype == CORETYPE_ANY )
{
// TODO: Chage the HIR format to support very large arrays
- if( ptr->m_value > UINT_MAX ) {
- ERROR(ty.span(), E0000, "Array size out of bounds - 0x" << ::std::hex << ptr->m_value << " > 0x" << UINT_MAX);
+ if( ptr->m_value >= UINT64_MAX ) {
+ ERROR(ty.span(), E0000, "Array size out of bounds - 0x" << ::std::hex << ptr->m_value << " > 0x" << UINT64_MAX << " in " << ::std::dec << ty);
}
auto size_val = static_cast<unsigned int>( ptr->m_value );
return ::HIR::TypeRef::new_array( mv$(inner), size_val );
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
index 13300bbc..e61c9ec7 100644
--- a/src/hir/type.hpp
+++ b/src/hir/type.hpp
@@ -220,7 +220,7 @@ public:
(Array, struct {
::std::unique_ptr<TypeRef> inner;
::std::shared_ptr<::HIR::ExprPtr> size;
- size_t size_val;
+ uint64_t size_val;
}),
(Slice, struct {
::std::unique_ptr<TypeRef> inner;