From 90f6b7b56b027c229b519a17ed4bda180b54883d Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 30 Jun 2023 22:08:10 +0100 Subject: gccrs: fix ICE with inserting autoderef mappings We were using the call-expr id for the autoderef mappings but this doesn't work when the call expression itself is part of a coercion-site so this changes the code to use the call-expression function path expression for the id instead which will not be duplicated again. Addresses #2105 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::generate_possible_fn_trait_call): use fnexpr * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_fn_trait_call): likewise Signed-off-by: Philip Herron --- gcc/rust/backend/rust-compile-expr.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/rust/backend/rust-compile-expr.cc') diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index eaf4a67..ed425ed 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -2893,7 +2893,8 @@ CompileExpr::generate_possible_fn_trait_call (HIR::CallExpr &expr, } // need to apply any autoderef's to the self argument - HirId autoderef_mappings_id = expr.get_mappings ().get_hirid (); + HIR::Expr *fnexpr = expr.get_fnexpr (); + HirId autoderef_mappings_id = fnexpr->get_mappings ().get_hirid (); std::vector *adjustments = nullptr; bool ok = ctx->get_tyctx ()->lookup_autoderef_mappings (autoderef_mappings_id, &adjustments); -- cgit v1.1