Skip to content

Commit 1142c34

Browse files
committed
Rollup merge of rust-lang#35874 - CensoredUsername:stmt_let_typed_fix, r=
This commit makes the return type of AstBuilder.stmt_let_typed match the return type of other AstBuilder.stmt* functions. This avoids unnecessary boxing/unboxing whenever Stmt's are stored in a Vec, which is the default use case.nnThis is a potentially plugin breaking change.
2 parents 7660bdf + 19e6f06 commit 1142c34

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libsyntax/ext/build.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub trait AstBuilder {
9696
ident: ast::Ident,
9797
typ: P<ast::Ty>,
9898
ex: P<ast::Expr>)
99-
-> P<ast::Stmt>;
99+
-> ast::Stmt;
100100
fn stmt_let_type_only(&self, span: Span, ty: P<ast::Ty>) -> ast::Stmt;
101101
fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt;
102102

@@ -556,7 +556,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
556556
ident: ast::Ident,
557557
typ: P<ast::Ty>,
558558
ex: P<ast::Expr>)
559-
-> P<ast::Stmt> {
559+
-> ast::Stmt {
560560
let pat = if mutbl {
561561
let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Mutable);
562562
self.pat_ident_binding_mode(sp, ident, binding_mode)
@@ -571,11 +571,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
571571
span: sp,
572572
attrs: ast::ThinVec::new(),
573573
});
574-
P(ast::Stmt {
574+
ast::Stmt {
575575
id: ast::DUMMY_NODE_ID,
576576
node: ast::StmtKind::Local(local),
577577
span: sp,
578-
})
578+
}
579579
}
580580

581581
// Generate `let _: Type;`, usually used for type assertions.

0 commit comments

Comments
 (0)