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/print/pprust.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/print') diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ff065b57b8d..345c592a011 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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 { -- cgit 1.4.1-3-g733a5