about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-09-09 20:16:19 +0000
committerbors <bors@rust-lang.org>2014-09-09 20:16:19 +0000
commit651106462c357b71a4ca2c02ba2bfedfc38b0035 (patch)
tree79cd7984fb470f273f5907c579a2db5f71296c7e /src/libsyntax/ext
parentb625d43f8fd2e9a800ca8a419f7d3f5f52604205 (diff)
parente5abe15ff55212c60fc4acc9bfc2bc79038507b8 (diff)
downloadrust-651106462c357b71a4ca2c02ba2bfedfc38b0035.tar.gz
rust-651106462c357b71a4ca2c02ba2bfedfc38b0035.zip
auto merge of #17127 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/quote.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 0c41db7ecd6..808e671f868 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -766,7 +766,9 @@ fn expand_wrapper(cx: &ExtCtxt,
         cx.view_use_glob(sp, ast::Inherited, ids_ext(path))
     }).collect();
 
-    let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr);
+    // Explicitly borrow to avoid moving from the invoker (#16992)
+    let cx_expr_borrow = cx.expr_addr_of(sp, cx.expr_deref(sp, cx_expr));
+    let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr_borrow);
 
     cx.expr_block(cx.block_all(sp, uses, vec!(stmt_let_ext_cx), Some(expr)))
 }