diff options
author | John Hodge <tpg@mutabah.net> | 2016-07-12 18:20:10 +1000 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-07-12 18:20:10 +1000 |
commit | cd4f12dd46d26e59bbdfc1f83c815c0af5c46307 (patch) | |
tree | e5425090e837ca5a16353910af3d1395fd7a9115 | |
parent | 3cf94484ee909a1f84a8c93074b1bf7d96c70f5c (diff) | |
download | mrust-cd4f12dd46d26e59bbdfc1f83c815c0af5c46307.tar.gz |
HIR Typecheck CS - Allow casts from fn-types to `*const ()`
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index db86900e..c98d9c59 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -1312,7 +1312,15 @@ namespace { (Pointer, TU_MATCH_DEF( ::HIR::TypeRef::Data, (src_ty.m_data), (s_e), ( - ERROR(sp, E0000, "Invalid cast to pointer"); + ERROR(sp, E0000, "Invalid cast to pointer from " << src_ty); + ), + (Function, + if( e.type == ::HIR::BorrowType::Shared && *e.inner == ::HIR::TypeRef::new_unit() ) { + this->m_completed = true; + } + else { + ERROR(sp, E0000, "Invalid cast to pointer from " << src_ty); + } ), (Primitive, if( s_e != ::HIR::CoreType::Usize ) { |