@@ -98,12 +98,9 @@ pub trait AstBuilder {
9898 fn stmt_item ( & self , sp : Span , item : P < ast:: Item > ) -> ast:: Stmt ;
9999
100100 // blocks
101- fn block ( & self , span : Span , stmts : Vec < ast:: Stmt > ,
102- expr : Option < P < ast:: Expr > > ) -> P < ast:: Block > ;
101+ fn block ( & self , span : Span , stmts : Vec < ast:: Stmt > ) -> P < ast:: Block > ;
103102 fn block_expr ( & self , expr : P < ast:: Expr > ) -> P < ast:: Block > ;
104- fn block_all ( & self , span : Span ,
105- stmts : Vec < ast:: Stmt > ,
106- expr : Option < P < ast:: Expr > > ) -> P < ast:: Block > ;
103+ fn block_all ( & self , span : Span , stmts : Vec < ast:: Stmt > ) -> P < ast:: Block > ;
107104
108105 // expressions
109106 fn expr ( & self , span : Span , node : ast:: ExprKind ) -> P < ast:: Expr > ;
@@ -508,7 +505,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
508505 }
509506
510507 fn stmt_expr ( & self , expr : P < ast:: Expr > ) -> ast:: Stmt {
511- respan ( expr. span , ast:: StmtKind :: Semi ( expr, ast:: DUMMY_NODE_ID ) )
508+ respan ( expr. span , ast:: StmtKind :: Expr ( expr, ast:: DUMMY_NODE_ID ) )
512509 }
513510
514511 fn stmt_let ( & self , sp : Span , mutbl : bool , ident : ast:: Ident ,
@@ -556,9 +553,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
556553 P ( respan ( sp, ast:: StmtKind :: Decl ( P ( decl) , ast:: DUMMY_NODE_ID ) ) )
557554 }
558555
559- fn block ( & self , span : Span , stmts : Vec < ast:: Stmt > ,
560- expr : Option < P < Expr > > ) -> P < ast:: Block > {
561- self . block_all ( span, stmts, expr)
556+ fn block ( & self , span : Span , stmts : Vec < ast:: Stmt > ) -> P < ast:: Block > {
557+ self . block_all ( span, stmts)
562558 }
563559
564560 fn stmt_item ( & self , sp : Span , item : P < ast:: Item > ) -> ast:: Stmt {
@@ -567,19 +563,18 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
567563 }
568564
569565 fn block_expr ( & self , expr : P < ast:: Expr > ) -> P < ast:: Block > {
570- self . block_all ( expr. span , Vec :: new ( ) , Some ( expr) )
571- }
572- fn block_all ( & self ,
573- span : Span ,
574- stmts : Vec < ast:: Stmt > ,
575- expr : Option < P < ast:: Expr > > ) -> P < ast:: Block > {
576- P ( ast:: Block {
577- stmts : stmts,
578- expr : expr,
579- id : ast:: DUMMY_NODE_ID ,
580- rules : BlockCheckMode :: Default ,
581- span : span,
582- } )
566+ self . block_all ( expr. span , vec ! [ Spanned {
567+ span: expr. span,
568+ node: ast:: StmtKind :: Expr ( expr, ast:: DUMMY_NODE_ID ) ,
569+ } ] )
570+ }
571+ fn block_all ( & self , span : Span , stmts : Vec < ast:: Stmt > ) -> P < ast:: Block > {
572+ P ( ast:: Block {
573+ stmts : stmts,
574+ id : ast:: DUMMY_NODE_ID ,
575+ rules : BlockCheckMode :: Default ,
576+ span : span,
577+ } )
583578 }
584579
585580 fn expr ( & self , span : Span , node : ast:: ExprKind ) -> P < ast:: Expr > {
@@ -948,14 +943,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
948943 ids : Vec < ast:: Ident > ,
949944 stmts : Vec < ast:: Stmt > )
950945 -> P < ast:: Expr > {
951- self . lambda ( span, ids, self . block ( span, stmts, None ) )
946+ self . lambda ( span, ids, self . block ( span, stmts) )
952947 }
953948 fn lambda_stmts_0 ( & self , span : Span , stmts : Vec < ast:: Stmt > ) -> P < ast:: Expr > {
954- self . lambda0 ( span, self . block ( span, stmts, None ) )
949+ self . lambda0 ( span, self . block ( span, stmts) )
955950 }
956951 fn lambda_stmts_1 ( & self , span : Span , stmts : Vec < ast:: Stmt > ,
957952 ident : ast:: Ident ) -> P < ast:: Expr > {
958- self . lambda1 ( span, self . block ( span, stmts, None ) , ident)
953+ self . lambda1 ( span, self . block ( span, stmts) , ident)
959954 }
960955
961956 fn arg ( & self , span : Span , ident : ast:: Ident , ty : P < ast:: Ty > ) -> ast:: Arg {
0 commit comments