From ccf0d8399e1ef3ed6bf7005650ce42aa646b5cc7 Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Sat, 7 Oct 2017 16:36:28 +0200 Subject: Adds support for immovable generators. Move checking of invalid borrows across suspension points to borrowck. Fixes #44197, #45259 and #45093. --- src/libsyntax/ext/build.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/ext') 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 { 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) -> P { -- cgit 1.4.1-3-g733a5