diff options
| author | Keegan McAllister <kmcallister@mozilla.com> | 2014-09-05 19:50:05 -0700 |
|---|---|---|
| committer | Keegan McAllister <kmcallister@mozilla.com> | 2014-09-08 11:30:55 -0700 |
| commit | 2b3619412fab979f2599227ef387c91d7c1ee28a (patch) | |
| tree | d2a763ee6194a701a4f345a69137ab386b3a7543 /src/libsyntax | |
| parent | 6f34760e4173dda94162502153fe4c5a2a96fc9d (diff) | |
| download | rust-2b3619412fab979f2599227ef387c91d7c1ee28a.tar.gz rust-2b3619412fab979f2599227ef387c91d7c1ee28a.zip | |
quote: Explicitly borrow the ExtCtxt
Fixes #16992.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 4 |
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))) } |
