diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-06 13:10:35 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-06 13:10:35 +0800 |
commit | 256e89db445be8567bea0bab33bdeade9e25c7a8 (patch) | |
tree | 104eddb03367998d62981f1983bd55e959ec615a /src | |
parent | 2988d96c4c985321650853b120dc2c973ed7ed78 (diff) | |
download | mrust-256e89db445be8567bea0bab33bdeade9e25c7a8.tar.gz |
HIR Expand UFCS - HACK: Don't desugar derefs of Box
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_expand/ufcs_everything.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hir_expand/ufcs_everything.cpp b/src/hir_expand/ufcs_everything.cpp index c7c19d8c..56dc4331 100644 --- a/src/hir_expand/ufcs_everything.cpp +++ b/src/hir_expand/ufcs_everything.cpp @@ -24,11 +24,15 @@ namespace { { const ::HIR::Crate& m_crate; ::HIR::ExprNodeP m_replacement; + ::HIR::SimplePath m_lang_Box; public: ExprVisitor_Mutate(const ::HIR::Crate& crate): m_crate(crate) { + if( crate.m_lang_items.count("owned_box") > 0 ) { + m_lang_Box = crate.m_lang_items.at("owned_box"); + } } void visit_node_ptr(::HIR::ExprPtr& root) { const auto& node_ref = *root; @@ -624,6 +628,13 @@ namespace { BUG(sp, "Deref on unexpected type - " << ty_val); ), (Path, + TU_IFLET( ::HIR::Path::Data, e.path.m_data, Generic, pe, + // Box<T> ("owned_box") is magical! + if( pe.m_path == m_lang_Box ) { + //TODO(sp, "Deref on Box"); + return ; + } + ) ), (Pointer, return ; @@ -650,7 +661,7 @@ namespace { langitem = method = "deref_mut"; break; case ::HIR::ValueUsage::Move: - TODO(sp, "Support moving out of borrows"); + TODO(sp, "ValueUsage::Move for desugared Deref of " << node.m_value->m_res_type); break; } // Needs replacement, continue |