about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-10-07 16:36:28 +0200
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2018-01-23 05:10:38 +0100
commitccf0d8399e1ef3ed6bf7005650ce42aa646b5cc7 (patch)
tree78166bd01ee1a24b9251e6cdf16dd631d3cf65e1 /src/libsyntax/ext
parent47a8eb7c4e24b61a8a9ab4eaff60ef65291aaa56 (diff)
downloadrust-ccf0d8399e1ef3ed6bf7005650ce42aa646b5cc7.tar.gz
rust-ccf0d8399e1ef3ed6bf7005650ce42aa646b5cc7.zip
Adds support for immovable generators. Move checking of invalid borrows across suspension points to borrowck. Fixes #44197, #45259 and #45093.
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/build.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 7f7ff56fd7f..cf63592c2ec 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -912,6 +912,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
                       fn_decl_span: Span) // span of the `|...|` part
                       -> P<ast::Expr> {
         self.expr(span, ast::ExprKind::Closure(ast::CaptureBy::Ref,
+                                               ast::Movability::Movable,
                                                fn_decl,
                                                body,
                                                fn_decl_span))
@@ -930,7 +931,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
         // part of the lambda, but it probably (maybe?) corresponds to
         // the entire lambda body. Probably we should extend the API
         // here, but that's not entirely clear.
-        self.expr(span, ast::ExprKind::Closure(ast::CaptureBy::Ref, fn_decl, body, span))
+        self.expr(span, ast::ExprKind::Closure(ast::CaptureBy::Ref,
+                                               ast::Movability::Movable,
+                                               fn_decl,
+                                               body,
+                                               span))
     }
 
     fn lambda0(&self, span: Span, body: P<ast::Expr>) -> P<ast::Expr> {