From e5a51fcee6b0fd19cba97ce5e5f37f6889258581 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 1 Oct 2016 10:37:24 +0800 Subject: (minor) Add TODO regarding by-borrow closure captures --- src/hir_expand/closures.cpp | 1 + src/mir/from_hir.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/hir_expand/closures.cpp b/src/hir_expand/closures.cpp index 7ca4fd25..fb30efe6 100644 --- a/src/hir_expand/closures.cpp +++ b/src/hir_expand/closures.cpp @@ -494,6 +494,7 @@ namespace { // - Types of captured variables (to be monomorphised) ::std::vector< ::HIR::VisEnt< ::HIR::TypeRef> > capture_types; for(const auto binding_idx : node.m_var_captures) { + // TODO: By-borrow captures (check the value usage type) auto ty_mono = monomorphise_type_with(sp, m_variable_types.at(binding_idx).clone(), monomorph_cb); // - Fix type to replace closure types with known paths ExprVisitor_Fixup::fix_type(m_resolve.m_crate, ty_mono); diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 7ead584c..94df9164 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -1583,6 +1583,7 @@ namespace { vals.push_back( ::MIR::LValue::make_Variable(cap_idx) ); } else { + // TODO: Get correct borrow type (based on annotations stored in the node) auto borrow_ty = ::HIR::BorrowType::Shared; auto lval = m_builder.lvalue_or_temp( node.span(), ::HIR::TypeRef::new_borrow(borrow_ty, m_variable_types[cap_idx].clone()), -- cgit v1.2.3