summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-31 17:51:58 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-31 17:51:58 +0800
commit08ef338ac81dfa2966420c00acdd5dac06bd9e04 (patch)
treea46f2ad3f05b5b69f0073ba4eb0e5751e953bb58
parent62aa3d8b33932d96122ce24c40ea47a4171bd653 (diff)
downloadmrust-08ef338ac81dfa2966420c00acdd5dac06bd9e04.tar.gz
HIR Typecheck Expr - Allow `fn` -> `*const u8` casts
-rw-r--r--src/hir_typeck/expr_cs.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index d3c976a2..c0fb935d 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -1983,11 +1983,12 @@ namespace {
ERROR(sp, E0000, "Invalid cast to pointer from " << src_ty);
),
(Function,
- if( *e.inner == ::HIR::TypeRef::new_unit() ) {
+ // TODO: What is the valid set? *const () and *const u8 at least are allowed
+ if( *e.inner == ::HIR::TypeRef::new_unit() || *e.inner == ::HIR::CoreType::U8 ) {
this->m_completed = true;
}
else {
- ERROR(sp, E0000, "Invalid cast to pointer from " << src_ty);
+ ERROR(sp, E0000, "Invalid cast to " << tgt_ty << " from " << src_ty);
}
),
(Primitive,