about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
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/ast.rs
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/ast.rs')
-rw-r--r--src/libsyntax/ast.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index a64f1e9e400..d6e26057ea8 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1100,7 +1100,7 @@ pub enum ExprKind {
     /// A closure (for example, `move |a, b, c| a + b + c`)
     ///
     /// The final span is the span of the argument block `|...|`
-    Closure(CaptureBy, P<FnDecl>, P<Expr>, Span),
+    Closure(CaptureBy, Movability, P<FnDecl>, P<Expr>, Span),
     /// A block (`{ ... }`)
     Block(P<Block>),
     /// A catch block (`catch { ... }`)
@@ -1194,6 +1194,13 @@ pub enum CaptureBy {
     Ref,
 }
 
+/// The movability of a generator / closure literal
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
+pub enum Movability {
+    Static,
+    Movable,
+}
+
 pub type Mac = Spanned<Mac_>;
 
 /// Represents a macro invocation. The Path indicates which macro