From: Jakub Dupak Date: Fri, 2 Feb 2024 13:33:56 +0000 (+0100) Subject: gccrs: borrowck: BIR: use callable API X-Git-Tag: basepoints/gcc-16~6961 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=deca20fa566de2db41237ca43c7531287e980166;p=thirdparty%2Fgcc.git gccrs: borrowck: BIR: use callable API gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Use callable API Signed-off-by: Jakub Dupak --- diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc b/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc index 2c916294ca7..ea8107b1fb7 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc +++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc @@ -248,25 +248,12 @@ ExprStmtBuilder::visit (HIR::CallExpr &expr) PlaceId fn = visit_expr (*expr.get_fnexpr ()); std::vector arguments = visit_list (expr.get_arguments ()); - auto *call_type = ctx.place_db[fn].tyty; - if (auto fn_type = call_type->try_as ()) - { - for (size_t i = 0; i < fn_type->get_params ().size (); ++i) - { - coercion_site (arguments[i], fn_type->get_params ()[i].second); - } - } - else if (auto fn_ptr_type = call_type->try_as ()) - { - for (size_t i = 0; i < fn_ptr_type->get_params ().size (); ++i) - { - coercion_site (arguments[i], - fn_ptr_type->get_params ()[i].get_tyty ()); - } - } - else + const auto fn_type + = ctx.place_db[fn].tyty->as (); + + for (size_t i = 0; i < fn_type->get_num_params (); ++i) { - rust_unreachable (); + coercion_site (arguments[i], fn_type->get_param_type_at (i)); } return_expr (new CallExpr (fn, std::move (arguments)), lookup_type (expr),