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:
@@ -2162,7 +2162,8 @@ impl<'a> State<'a> {
|
||||
}
|
||||
self.bclose_(expr.span, INDENT_UNIT)?;
|
||||
}
|
||||
ast::ExprKind::Closure(capture_clause, ref decl, ref body, _) => {
|
||||
ast::ExprKind::Closure(capture_clause, movability, ref decl, ref body, _) => {
|
||||
self.print_movability(movability)?;
|
||||
self.print_capture_clause(capture_clause)?;
|
||||
|
||||
self.print_fn_block_args(decl)?;
|
||||
@@ -2777,6 +2778,14 @@ impl<'a> State<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_movability(&mut self, movability: ast::Movability)
|
||||
-> io::Result<()> {
|
||||
match movability {
|
||||
ast::Movability::Static => self.word_space("static"),
|
||||
ast::Movability::Movable => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_capture_clause(&mut self, capture_clause: ast::CaptureBy)
|
||||
-> io::Result<()> {
|
||||
match capture_clause {
|
||||
|
||||
Reference in New Issue
Block a user