diff options
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-implitem.cc')
| -rw-r--r-- | gcc/rust/hir/rust-ast-lower-implitem.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-implitem.cc b/gcc/rust/hir/rust-ast-lower-implitem.cc index 5db11cb..8fd9d16 100644 --- a/gcc/rust/hir/rust-ast-lower-implitem.cc +++ b/gcc/rust/hir/rust-ast-lower-implitem.cc @@ -115,7 +115,7 @@ ASTLowerImplItem::visit (AST::Function &function) { HIR::WhereClauseItem *i = ASTLowerWhereClauseItem::translate (*item.get ()); - where_clause_items.push_back (std::unique_ptr<HIR::WhereClauseItem> (i)); + where_clause_items.emplace_back (i); } HIR::WhereClause where_clause (std::move (where_clause_items)); @@ -162,10 +162,9 @@ ASTLowerImplItem::visit (AST::Function &function) mappings.get_next_hir_id (crate_num), UNKNOWN_LOCAL_DEFID); - auto hir_param - = HIR::FunctionParam (mapping, std::move (translated_pattern), - std::move (translated_type), param.get_locus ()); - function_params.push_back (std::move (hir_param)); + function_params.emplace_back (mapping, std::move (translated_pattern), + std::move (translated_type), + param.get_locus ()); } bool terminated = false; @@ -272,10 +271,9 @@ ASTLowerTraitItem::visit (AST::Function &func) mappings.get_next_hir_id (crate_num), UNKNOWN_LOCAL_DEFID); - auto hir_param - = HIR::FunctionParam (mapping, std::move (translated_pattern), - std::move (translated_type), param.get_locus ()); - function_params.push_back (std::move (hir_param)); + function_params.emplace_back (mapping, std::move (translated_pattern), + std::move (translated_type), + param.get_locus ()); } if (func.has_self_param ()) @@ -320,10 +318,10 @@ ASTLowerTraitItem::visit (AST::Function &func) } void -ASTLowerTraitItem::visit (AST::TraitItemConst &constant) +ASTLowerTraitItem::visit (AST::ConstantItem &constant) { HIR::Type *type = ASTLoweringType::translate (constant.get_type ()); - HIR::Expr *expr = constant.has_expression () + HIR::Expr *expr = constant.has_expr () ? ASTLoweringExpr::translate (constant.get_expr ()) : nullptr; |
