summaryrefslogtreecommitdiff
path: root/src/mir/from_hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-10-26 12:00:33 +0800
committerJohn Hodge <tpg@mutabah.net>2019-10-26 12:00:33 +0800
commit6a2e3b6a095a9a1acdccf4edee4ba3900ce6489a (patch)
treee2ae293dea1029479761cc824a8f97078c8f163b /src/mir/from_hir.cpp
parent14c531b0b6c2ac97334ad27483d8266065bda580 (diff)
downloadmrust-6a2e3b6a095a9a1acdccf4edee4ba3900ce6489a.tar.gz
HIR Typecheck - Allow coercion to add `unsafe` to function pointers
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r--src/mir/from_hir.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index b8033a00..4ab1bf00 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -1279,6 +1279,11 @@ namespace {
TU_MATCH_HDRA( (ty_out.m_data), {)
default:
BUG(node.span(), "Invalid cast to " << ty_out << " from " << ty_in);
+ TU_ARMA(Function, de) {
+ // Just trust the previous stages.
+ ASSERT_BUG(node.span(), ty_in.m_data.is_Function(), ty_in);
+ ASSERT_BUG(node.span(), de.m_arg_types == ty_in.m_data.as_Function().m_arg_types, ty_in);
+ }
TU_ARMA(Pointer, de) {
if( ty_in.m_data.is_Primitive() ) {
const auto& ie = ty_in.m_data.as_Primitive();