Adds support for immovable generators. Move checking of invalid borrows across suspension points to borrowck. Fixes #44197, #45259 and #45093.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user