auto merge of #15929 : pcwalton/rust/by-ref-closures, r=alexcrichton
by-reference upvars. This partially implements RFC 38. A snapshot will be needed to turn this on, because stage0 cannot yet parse the keyword. Part of #12831. r? @alexcrichton
This commit is contained in:
@@ -1473,7 +1473,9 @@ impl<'a> State<'a> {
|
||||
}
|
||||
try!(self.bclose_(expr.span, indent_unit));
|
||||
}
|
||||
ast::ExprFnBlock(ref decl, ref body) => {
|
||||
ast::ExprFnBlock(capture_clause, ref decl, ref body) => {
|
||||
try!(self.print_capture_clause(capture_clause));
|
||||
|
||||
// in do/for blocks we don't want to show an empty
|
||||
// argument list, but at this point we don't know which
|
||||
// we are inside.
|
||||
@@ -1503,7 +1505,9 @@ impl<'a> State<'a> {
|
||||
// empty box to satisfy the close.
|
||||
try!(self.ibox(0));
|
||||
}
|
||||
ast::ExprUnboxedFn(ref decl, ref body) => {
|
||||
ast::ExprUnboxedFn(capture_clause, ref decl, ref body) => {
|
||||
try!(self.print_capture_clause(capture_clause));
|
||||
|
||||
// in do/for blocks we don't want to show an empty
|
||||
// argument list, but at this point we don't know which
|
||||
// we are inside.
|
||||
@@ -2071,6 +2075,14 @@ impl<'a> State<'a> {
|
||||
self.maybe_print_comment(decl.output.span.lo)
|
||||
}
|
||||
|
||||
pub fn print_capture_clause(&mut self, capture_clause: ast::CaptureClause)
|
||||
-> IoResult<()> {
|
||||
match capture_clause {
|
||||
ast::CaptureByValue => Ok(()),
|
||||
ast::CaptureByRef => self.word_space("ref"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_proc_args(&mut self, decl: &ast::FnDecl) -> IoResult<()> {
|
||||
try!(word(&mut self.s, "proc"));
|
||||
try!(word(&mut self.s, "("));
|
||||
|
||||
Reference in New Issue
Block a user